macro to delete rows if cell blank in column

  • Thread starter Thread starter puiuluipui
  • Start date Start date
P

puiuluipui

Hi, i need a macro to delete empty rows if a cell in A3:A200 is blank.
Ex:
A B C
3 FILL FILL FILL
4 FILL FILL
5 FILL FILL FILL
6
7 FILL FILL FILL
In this example, i need to delete row 4 and 6.
Can this be done?
Thanks!
 
Hi

Try this:

Sub DeleteRows()
FirstRow = 3
LastRow = 200

For r = LastRow To FirstRow Step -1
If Range("A" & r).Value = "" Then
Rows(r).EntireRow.Delete
End If
Next
End Sub

Regards,
Per
 
Sub rowkiller()
Set r = Range("A3:A200")
Set rr = r.SpecialCells(xlCellTypeBlanks)
rr.EntireRow.Delete
End Sub
 
It's working.
Thanks!

Per Jessen said:
Hi

Try this:

Sub DeleteRows()
FirstRow = 3
LastRow = 200

For r = LastRow To FirstRow Step -1
If Range("A" & r).Value = "" Then
Rows(r).EntireRow.Delete
End If
Next
End Sub

Regards,
Per
 
Back
Top