If a cell is blank, delete the whole row

Monsignor

Board Regular
Joined
May 30, 2011
Messages
162
I don't know why this is so hard.

The goal:

Go through Column R, rows 2 thru 46.
If the cell is empty, delete the whole row, then check the next row in Column R

The number of rows is fixed. It'll always be 2 thru 46.
(My research shows lots of code for variable length ranges)

Among other things, I've tried this:

Code:
ActiveSheet.Columns("R").SpecialCells(xlCellTypeBlanks).EntireRow.Delete

What's missing?
 
Try

ActiveSheet.Range("R2:R46").SpecialCells(xlCellTypeBlanks).EntireRow.Delete

If that doesn't work, it means your blanks are not really blank..
Try
Code:
With ActiveSheet.Range("R2:R46")
    .Value = .Value
    .SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With

I have many snippets of code to do this, but each one needed to be run several times. This is the first to actually work the first time! Thanks!
 
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.

Forum statistics

Threads
1,222,408
Messages
6,165,872
Members
451,989
Latest member
DannyBoy1977

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