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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,223,711
Messages
6,174,028
Members
452,542
Latest member
Bricklin

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