DELETE ROWS BASED ON BLANK CELLS IN COL "A"

Eddie G.

Board Regular
Joined
Feb 27, 2002
Messages
98
I am trying to use some existing code to do this but I am having no luck. I need a macro that will search all of column A and delete rows if the cells in COL A are blank. thanks....
 
Re: DELETE ROWS BASED ON BLANK CELLS IN COL "A"

This is fairly quick:

Code:
Sub deltime2()
[a:a].SpecialCells(xlCellTypeBlanks).EntireRow.delete
End Sub

Hope this helps.

I tried using this code for multiple sheets and it doesn't work. I got it to run on just one sheet, but it won't work on multiple sheets. Any suggestions?

Code:
Sheets("IMPORTANT").Select
Call deltime2
Sheets("Overview").Select
Call deltime2
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Re: DELETE ROWS BASED ON BLANK CELLS IN COL "A"

I think you need .activate instead of .select

Code:
Sheets("IMPORTANT").Activate
deltime2
Sheets("Overview").Activate
deltime2

That being said, do you want to do this on every sheet? You could make it loop through every sheet and perform the action without ever having to select/activate a range.
 
Last edited:
Upvote 0
Re: DELETE ROWS BASED ON BLANK CELLS IN COL "A"

I would like to do it on every sheet. Not sure how to loop through sheets though. Still learning vba.
 
Upvote 0
Re: DELETE ROWS BASED ON BLANK CELLS IN COL "A"

Code:
Sub Clean()

Dim WS As Worksheet

For Each WS In ActiveWorkbook.Worksheets
        
    WS.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    On Error Resume Next
    
    Next

End Sub
See if this works. Be sure to save your data first, just in case.
 
Upvote 0

Forum statistics

Threads
1,214,806
Messages
6,121,672
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top