Deleteing rows after a Go to/Filtering

R

Ron Luzius

In a macro, I am selecting a Column and then doing a Goto > Special >
Blanks.

I need to delete that and all following rows in the same macro.

So far I have;
Columns("A:A").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
ActiveCell.Activate

How can I get what row the Active cell is so I can do this;
Rows("???:10000").Select ??? = the Active Row
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp

Many Thanks in advaance!
 
M

Mike Fogleman

I believe a one-liner will delete all blank rows in column A:

Columns("A:A").SpecialCells(xlCellTypeBlanks).Delete

This will only delete from column A, non of the other columns.

Mike F
 
R

Ron Luzius

That will work sort of..
I actually need to delete the entire row(s) up to and including row 10000.

I did a
Columns("A:X").SpecialCells(xlCellTypeBlanks).Delete

But as an automated macro (no human intervention), how do I get it to not
ask "Are you sure?"
 
M

Mike Fogleman

Application.DisplayAlerts = False
Columns("A:X").SpecialCells(xlCellTypeBlanks).Delete
Application.DisplayAlerts = True

Also you may try:

Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete

Mike F
 

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

Top