ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro to delete rows if cell blank in column (https://www.excelbanter.com/excel-discussion-misc-queries/245382-macro-delete-rows-if-cell-blank-column.html)

puiuluipui

macro to delete rows if cell blank in column
 
Hi, i need a macro to delete empty rows if a cell in A3:A200 is blank.
Ex:
A B C
3 FILL FILL FILL
4 FILL FILL
5 FILL FILL FILL
6
7 FILL FILL FILL
In this example, i need to delete row 4 and 6.
Can this be done?
Thanks!

Per Jessen

macro to delete rows if cell blank in column
 
Hi

Try this:

Sub DeleteRows()
FirstRow = 3
LastRow = 200

For r = LastRow To FirstRow Step -1
If Range("A" & r).Value = "" Then
Rows(r).EntireRow.Delete
End If
Next
End Sub

Regards,
Per

"puiuluipui" skrev i meddelelsen
...
Hi, i need a macro to delete empty rows if a cell in A3:A200 is blank.
Ex:
A B C
3 FILL FILL FILL
4 FILL FILL
5 FILL FILL FILL
6
7 FILL FILL FILL
In this example, i need to delete row 4 and 6.
Can this be done?
Thanks!



Gary''s Student

macro to delete rows if cell blank in column
 
Sub rowkiller()
Set r = Range("A3:A200")
Set rr = r.SpecialCells(xlCellTypeBlanks)
rr.EntireRow.Delete
End Sub

--
Gary''s Student - gsnu200907

puiuluipui

macro to delete rows if cell blank in column
 
It's working.
Thanks!

"Per Jessen" wrote:

Hi

Try this:

Sub DeleteRows()
FirstRow = 3
LastRow = 200

For r = LastRow To FirstRow Step -1
If Range("A" & r).Value = "" Then
Rows(r).EntireRow.Delete
End If
Next
End Sub

Regards,
Per

"puiuluipui" skrev i meddelelsen
...
Hi, i need a macro to delete empty rows if a cell in A3:A200 is blank.
Ex:
A B C
3 FILL FILL FILL
4 FILL FILL
5 FILL FILL FILL
6
7 FILL FILL FILL
In this example, i need to delete row 4 and 6.
Can this be done?
Thanks!




puiuluipui

macro to delete rows if cell blank in column
 
It's working.
Thanks!

"Gary''s Student" wrote:

Sub rowkiller()
Set r = Range("A3:A200")
Set rr = r.SpecialCells(xlCellTypeBlanks)
rr.EntireRow.Delete
End Sub

--
Gary''s Student - gsnu200907



All times are GMT +1. The time now is 02:04 PM.

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