View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Paul B[_6_] Paul B[_6_] is offline
external usenet poster
 
Posts: 135
Default Deleting blank cells in a selection

Novice, the macro deletes the blanks and moves the data up, I am not sure
what you need
You can also do it without a macro, select the area, edit, goto, special,
blanks, then edit delete

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
"Novice" wrote in message
...
Thanks for the tip PaulB
But, I can't get it to work...

I run the following macro after highlighting the entire
selection. The selection contains values and there are two
blank cells in the same row in the middle of the two
columns. Now I want the deleted space removed and the
lower portion of data shifted upwards.

Here's the code...


Public Sub DeleteRowOnCell()
On Error Resume Next
Selection.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp
ActiveSheet.UsedRange

End Sub
-----Original Message-----
Novice,try this and see if it will do what you want
Range("A2:B9").SpecialCells(xlCellTypeBlanks).Dele te

Shift:=xlUp


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can

benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
"Novice" wrote in

message
...
Hi,
I am trying to create a macro that will delete blank

cells
in a selection. The only code I have found
uses "Selection.SpecialCells
(xlCellTypeBlanks).EntireRow.Delete"

However, I want to delete just the blank cells in a
particulary row if both are blank, not the entire row in
the worksheet.
For example selection is A2:B9 and cells A4 and B4 are
both zero or blank. I need cells A4 and B4 deleted and

the
remaining cell selection moved up a row.

Please help! Thanks..



.