Removing blank and error cells from a range of cells

j_e_r16

New Member
Joined
Jul 6, 2007
Messages
11
Hi,

I have a worksheet with one word per cell, but with error (N/A) cells and blank cells intermittently dispersed throughout.
To remove these blank/error cells, I have been going to
Edit-->Go to--> Special --> Blank or Constant,error
and then Deleting these cells by shifting them up. This is a very time consuming process, though, because you can only select a certain amount of these cells at a time, so I have to do this for about 3 columns at a time for a worksheet filled up through the I* columns.

Does anyone know of a better way to remove these blank/error cells? Perhaps code for VBE?

Thanks!!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I would start by recording a macro doing what you are already doing. That may give you the macro that will do that everytime. I would see that being the easiest until someone else paste's the code you actually need.
 
Upvote 0
try using Special Cells & Application.Union

Code:
Dim rBlanks As Range
    Dim rErrors As Range
    Dim TheRng As Range
    With ActiveSheet
        Set rBlanks = .Cells.SpecialCells(xlCellTypeBlanks)
'16 limits to Errors
        Set rErrors = .Cells.SpecialCells(xlCellTypeFormulas, 16)
    End With
    Set TheRng = Application.Union(rBlanks, rErrors)
    'do something with the range
    MsgBox BigRng.Address
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,412
Members
448,959
Latest member
camelliaCase

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