Re: Clearing cells that only contain spaces

From: Tom Ogilvy (twogilvy_at_msn.com)
Date: 02/24/04


Date: Tue, 24 Feb 2004 16:44:32 -0500

Dim rng as Range, cell as Range
On Error Resume Next
set rng = Active***.UsedRange.SpecialCells(xlconstants,xlTextValues)
On Error goto 0
for each cell in rng
  if len(trim(cell.Value)) = 0 then
       cell.Clearcontents
  end if
Next

-- 
Regards,
Tom Ogilvy
"Rodrigo Ayres" <rodrigo.ayres@gov.ab.ca> wrote in message
news:F1838A8C-5C79-449F-B43B-FDAC5F0AA08A@microsoft.com...
>
> Hi all!
>
> Can anyone tell me how to write code to remove any number of spaces from
cells that ONLY contain spaces?
>
> Thank you!
>
> Rodrigo