View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default visual basic excel 2000

I think this macro will do what you want....

Sub ClearCellsThatLookBlank()
Dim Cell As Range
For Each Cell In ActiveSheet.UsedRange.Cells
If Len(Cell.Value) 0 And Len(Trim(Cell.Value)) = 0 Then Cell.Clear
Next
End Sub

--
Rick (MVP - Excel)



"JoenMar" wrote in message
...
Someone in our office used the spacebar to make some cells in a database
look
blank when they were not. I discovered this when trying to write a macro
to
manipulate the database with code that used the end up/down, etc. command
and
was being interrupted by visually blank spaces that were created by the
spacebar.

I am trying to write code to totally clear only the cells which appear to
be
blank and not remove the cells with good data.

I tried to select the general area including the data and use an If then
statement to look at the cells in the selection and clear only the ones
who's
value = 0. However I don't know the proper code to select the cells that
might equal zero in this Selection or Range. I'm getting error code 13
mismatches, etc.

Help!