ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete all rows where column A is blank (https://www.excelbanter.com/excel-programming/437281-delete-all-rows-where-column-blank.html)

Jodie

Delete all rows where column A is blank
 
I need to write a macro to delete all rows where column A is blank. Can
anyone help me with this please?
--
Thank you, Jodie

Chip Pearson

Delete all rows where column A is blank
 
Try some code like the following. Change the value "Sheet1" to the
appropriate worksheet name.


Sub AAA()
Dim LastRow As Long
Dim RowNdx As Long
Dim WS As Worksheet
Set WS = Worksheets("Sheet1")
With WS
LastRow = .UsedRange.SpecialCells(xlCellTypeLastCell) _
.EntireRow.Cells(1, "A")
For RowNdx = LastRow To 1 Step -1
If .Cells(RowNdx, "A").Value = vbNullString Then
.Rows(RowNdx).Delete
End If
Next RowNdx
End With
End Sub

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]



On Thu, 10 Dec 2009 13:59:01 -0800, Jodie
wrote:

I need to write a macro to delete all rows where column A is blank. Can
anyone help me with this please?


Homey

Delete all rows where column A is blank
 
Try this

Range("A:A").SpecialCells(xlCellTypeBlanks).Entire Row.Delete

"Jodie" wrote in message
...
I need to write a macro to delete all rows where column A is blank. Can
anyone help me with this please?
--
Thank you, Jodie



Ron de Bruin

Delete all rows where column A is blank
 
Warning: Look out with SpecialCells

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




--

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


"Homey" <noname wrote in message ...
Try this

Range("A:A").SpecialCells(xlCellTypeBlanks).Entire Row.Delete

"Jodie" wrote in message
...
I need to write a macro to delete all rows where column A is blank. Can
anyone help me with this please?
--
Thank you, Jodie



Gord Dibben

Delete all rows where column A is blank
 
Do you really need a macro?

Select column A

F5SpecialBlanksOK

EditDeleteEntire Row


Gord Dibben MS Excel MVP


On Thu, 10 Dec 2009 13:59:01 -0800, Jodie
wrote:

I need to write a macro to delete all rows where column A is blank. Can
anyone help me with this please?




All times are GMT +1. The time now is 11:14 AM.

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