View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
cimento cola cimento cola is offline
external usenet poster
 
Posts: 3
Default Delete entire row if A1,2,3... is empty

Hey there.
I have this piece of code:

Private Sub CommandButton1_Click()
Dim i As Double
i = 1

For i = 1 To 5850
Cells(i, 1).Select
If ActiveCell.Value = Empty Then ActiveCell.EntireRow.Delete
i = i + 1
Next

End Sub

I want this:
In range A1:A5850 if cells in the first column (A) are empty then delete
entire row.
Exmple:
A
1 5
2
3 3
4 1

It should only delete the 2 entire row.
Can anyone help?
With that piece of code i get an I/O error and no rows deleted...
Thanks,