ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete a row (https://www.excelbanter.com/excel-programming/291122-delete-row.html)

monika

Delete a row
 
I am checking if a particular cell is empty then I can
delete the entire
row..

This particular code is not working:
While Cells(i, 3) = ""
Rows("i:i").Select
Selection.Delete Shift:=xlUp
lastCellNum = lastCellNum - 1
i = i + 1
Wend

Thanks
monika


acw[_2_]

Delete a row
 
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
row.
This particular code is not working

While Cells(i, 3) = "
Rows("i:i").Selec
Selection.Delete Shift:=xlU
lastCellNum = lastCellNum -
i = i +
Wen
Thank

monik



Damian Lee

Delete a row
 
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


-----Original Message-----
I am checking if a particular cell is empty then I can
delete the entire
row..

This particular code is not working:
While Cells(i, 3) = ""
Rows("i:i").Select
Selection.Delete Shift:=xlUp
lastCellNum = lastCellNum - 1
i = i + 1
Wend

Thanks
monika

.


monika

Delete a row
 
Rows(i) worked quite well....

thanks
"Damian Lee" wrote in message
...
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


-----Original Message-----
I am checking if a particular cell is empty then I can
delete the entire
row..

This particular code is not working:
While Cells(i, 3) = ""
Rows("i:i").Select
Selection.Delete Shift:=xlUp
lastCellNum = lastCellNum - 1
i = i + 1
Wend

Thanks
monika

.





All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com