Delete a row

  • Thread starter Thread starter monika
  • Start date Start date
M

monika

I am checking if a particular cell is empty then I can
delete the entire
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top