Share via

VBA Code to Delete Empty Rows

Anonymous
2016-09-09T18:26:52+00:00

I am needing code that will search for all blank cells in column B12:B34 and delete the respective row for A12:K34.

Example - If B15 is blank then delete A15:K15 and shift cells up. 

Note: There are formulas in column B, so it will have to only look for values returned by the formula and not the formula itself.

Thank you so much!

Doug

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2016-09-09T19:25:24+00:00

See screenshot

My sub is

Sub RowGone()

 For k = 24 To 12 Step -1

  If Len(Cells(k, "B").Value) < 1 Then

     Cells(k, 1).EntireRow.Delete

  End If

 Next k

End Sub

I copied A1:K6 to A12 and ran my sub see how one row has gone.

In B12, I have the formula =IF(A12="c","",a12) so my sheet meets your requirement

Note how we start at the bottom (k= 24 To 12 Step -1) since deleting a row alters row number!

best wishes

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful