View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Charley Charley is offline
external usenet poster
 
Posts: 1
Default Macro to delete rows


-----Original Message-----
I was hoping to create a VBA function that would identify

empty or blank cells within a range, and then delete the
row associated with that empty or blank cell.

Can anyone provide some help?

Thanks!
.

here a macro:
Sub Macro1()
Dim x As Integer
Dim y As Integer
Dim x1 As Integer

x = "Row Start"
For x1 = "Row Start" To "Row end"
If Len(Cells(x, 5)) = 0 Then '"Column for blank"
exmple a = 1, c = 3
Rows(x).Select
Rows(x).Delete
x = x - 1 'You just delete a line, so need to
back up
End If

x = x + 1
Next x1
End Sub