Delete a row

  • Thread starter Thread starter monika
  • Start date Start date
Monik

1) has i been initialised to 1 somewhere
2) change the line
Rows("i:i").Selec
t
Rows(i & ":" & i).Selec

Ton

----- monika wrote: ----

I am checking if a particular cell is empty then I ca
delete the entir
 
Try this

Sub monika()
Dim i As Integer
Dim Lastcellnum
i = 1
Lastcellnum = 14
While i < Lastcellnum
If Cells(i, 1) = "" Then
Rows(i).Select
Selection.Delete Shift:=xlUp
Lastcellnum = Lastcellnum - 1
End If
i = i + 1
Wend
End Sub
 
Rows(i) worked quite well....

thanks
Damian Lee said:
Try this

Sub monika()
Dim i As Integer
Dim Lastcellnum
i = 1
Lastcellnum = 14
While i < Lastcellnum
If Cells(i, 1) = "" Then
Rows(i).Select
Selection.Delete Shift:=xlUp
Lastcellnum = Lastcellnum - 1
End If
i = i + 1
Wend
End Sub
 
Back
Top