Macro to delete row if column B is blank

eages

New Member
Joined
Jun 22, 2010
Messages
8
I am almost pulling out the white flag and surrendering to my evil enemy Macros.

I am hoping that there is someone out there who can help me with How to I write a macro that will check rows on a worksheet to see if Column B is blank and if found it will delete the row regardless of what data is in the other cells.

Cells range from A:L

Many thanks in advance
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
If blank means empty, then this would do it:

On error resume next
columns(2).specialcells(4).entirerow.delete
err.clear
 
Upvote 0
Hi
try these codes
Code:
sub eages()
dim a as long
for a = Cells(rows.count,2).end(xlup).row to 2 step -1
if cells(a,2)= "" then
rows(a).delete
end if
next a
msgbox "Complete"
end sub
Ravi
 
Upvote 0
Thanks Tom I can put the white sheet away and continue my fight against macros.

This works exactly sorry I didn't explain better in regards to blank means empty.
 
Upvote 0
OK, and hopefully you will regard macros as your friends fighting for you, and not an adversary fighting against you !!
 
Upvote 0

Forum statistics

Threads
1,215,038
Messages
6,122,798
Members
449,095
Latest member
m_smith_solihull

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