Vba code to search and delete

Closed
PM - Sep 21, 2010 at 05:48 AM
 Maja WL - Sep 25, 2010 at 05:04 PM
Hello,

I need to know the code to do the following:

Search in column D for blank spaces and then delete the whole row.

Thanks in advance

PM



Excel 2003
Related:

2 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Sep 21, 2010 at 06:58 AM
you can filter for blank and delete all visible row. If you want, you can record your action that will give you the macro
0
Change last row if you need!

Option Explicit

Sub DelRow()

Range("D1").Select

Do
If InStr(ActiveCell.Value, " ") > 0 Then
Rows(ActiveCell.Row).Delete
Else
Cells(ActiveCell.Row + 1, ActiveCell.Column).Select
End If

Loop Until ActiveCell.Row = 1000

End Sub
0