ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Rows if any cell in Column H is blank but do not Delete Fir (https://www.excelbanter.com/excel-programming/398323-delete-rows-if-any-cell-column-h-blank-but-do-not-delete-fir.html)

manfareed

Delete Rows if any cell in Column H is blank but do not Delete Fir
 
Hi ,

I need to delete any row which has a blank cell in Column H. But I do not
want to delete the first row because this will have a "Title" even though
Column H is blank.
Thanks

Ron de Bruin

Delete Rows if any cell in Column H is blank but do not Delete Fir
 
Try this

http://www.rondebruin.nl/specialcells.htm

Change this line
With Columns("A") ' You can also use a range like this Range("A1:A8000")

To

With Range("H2:H" & Rows.Count)

If you want to start in Row 2



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"manfareed" wrote in message ...
Hi ,

I need to delete any row which has a blank cell in Column H. But I do not
want to delete the first row because this will have a "Title" even though
Column H is blank.
Thanks


Gary''s Student

Delete Rows if any cell in Column H is blank but do not Delete Fir
 
Sub Macro1()
Dim i As Long
Set r = ActiveSheet.UsedRange
i = r.Rows.Count + r.Row - 1
For j = i To 2 Step -1
If IsEmpty(Cells(j, "H")) Then
Rows(j).EntireRow.Delete
End If
Next
End Sub
--
Gary''s Student - gsnu200747


"manfareed" wrote:

Hi ,

I need to delete any row which has a blank cell in Column H. But I do not
want to delete the first row because this will have a "Title" even though
Column H is blank.
Thanks


manfareed

Delete Rows if any cell in Column H is blank but do not Delete
 
Thanks it works

"Gary''s Student" wrote:

Sub Macro1()
Dim i As Long
Set r = ActiveSheet.UsedRange
i = r.Rows.Count + r.Row - 1
For j = i To 2 Step -1
If IsEmpty(Cells(j, "H")) Then
Rows(j).EntireRow.Delete
End If
Next
End Sub
--
Gary''s Student - gsnu200747


"manfareed" wrote:

Hi ,

I need to delete any row which has a blank cell in Column H. But I do not
want to delete the first row because this will have a "Title" even though
Column H is blank.
Thanks


manfareed

Delete Rows if any cell in Column H is blank but do not Delete
 
Thanks for the link



"Ron de Bruin" wrote:

Try this

http://www.rondebruin.nl/specialcells.htm

Change this line
With Columns("A") ' You can also use a range like this Range("A1:A8000")

To

With Range("H2:H" & Rows.Count)

If you want to start in Row 2



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"manfareed" wrote in message ...
Hi ,

I need to delete any row which has a blank cell in Column H. But I do not
want to delete the first row because this will have a "Title" even though
Column H is blank.
Thanks




All times are GMT +1. The time now is 09:25 AM.

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