View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default If, Then, Delete Entire Row, Loop, End

Hi JC

Try this, just change TargetRange as desired.

Sub DeleteEmptyRow()
Dim TargetRange As Range
Set TargetRange = Range("A10:A20") '<==Change to suit

EndRow = TargetRange.Cells(1, 1).Row
StartRow = TargetRange.Rows.Count + EndRow - 1

For r = StartRow To EndRow Step -1
If Cells(r, 1).Value = "" Or Cells(r, 1).Value = 0 Then
Rows(r).Delete
End If
Next
End Sub

Regards,
Per

"JC" skrev i meddelelsen
...
Hi,

I appreciate your help.
I need to run a conditional If Then statement on a defined table. If the
cell in column 1 is blank or null, then delete the entire row, and run
this
statement on every row until the end of the table.

Thanks again!,
JC