View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default delete blanks - sporadic

Those cells are not blank if they contain a formula.

You can get rid of these formulas and make the cells truly blank then select
them and delete.

Sub Clear_Stuff()
Dim rng As Range
With Selection
For Each rng In Selection
If rng.HasFormula And rng.Value = "" Then
rng.ClearContents
End If
Next rng
.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp 'or xlToLeft
End With
End Sub

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

First...create a backup copy of your original workbook.

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + r to open Project Explorer.

Find your workbook/project and select it.

Right-click and InsertModule. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Run the macro by going to ToolMacroMacros.

You can also assign this macro to a button or a shortcut key combo.


Gord



On Wed, 17 Jan 2007 09:07:02 -0800, Alina
wrote:

Thanks so much - but for some reason, it's not recognizing that there are any
blanks. My dataset is a copy/paste value from another tab that contains
formulas. The formulas say ="" if criteria is not met. Those end up being my
blank cells. I've tried changing the format. Any help would be appreciated.
Thanks

"Gord Dibben" wrote:

Select the range and F5SpecialBlanksOK

EditDeleteShift Up or Left whichever you choose.

Probably up, looking at your example, but xxxxx doesn't give a good read on
values.

Might be an idea to do this on a copy of the worksheet.


Gord Dibben MS Excel MVP

On Tue, 16 Jan 2007 15:29:01 -0800, Alina
wrote:

My dataset is from A2:G56. Each column has a different header. I have
sporadic blank cells throughout the dataset and want to delete them. How do I
delete the blank cells? See sample below: Thanks in advance :)

Principle Interest Fee1 Fee2 Disbursement
xxxx xxxxx xxxxx
xxxxx xxxxxx
xxxx