View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Clear blank cells


Reed, following cleans cells containing ' or (multiple) spaces.

Sub AlmostEmptyCleaner()
Dim r As Range, c As Range, u As Range

On Error Resume Next
Set r = ActiveSheet.UsedRange.SpecialCells(xlConstants)
On Error GoTo 0

If Not r Is Nothing Then
For Each c In r
If Trim(c.Formula) = vbNullString Then
If u Is Nothing Then Set u = c Else Set u = Union(u, c)
End If
Next
End If

If Not u Is Nothing Then
MsgBox "Cleaning " & u.Count & " cells"
u.ClearContents
Else
MsgBox "Nothing to clean"
End If
End Sub





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Reed wrote :

Hi,

I have a worksheet with cells that appear blank, but have an
"apostrophe" in them when you edit the cell. How can I clear all of
these cells?

Thanks,

Reed