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

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,941
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.
 

royUK

Well-known Member
Joined
Jul 24, 2002
Messages
1,606
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
 

Forum statistics

Threads
1,181,056
Messages
5,927,864
Members
436,573
Latest member
CMR237

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
Top