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 delete ghost spaces

I'm going to guess some of your spaces are non-breaking spaces (usually
acquired from webpage text), so try using this line of code inside your loop
(instead of the one you posted) and see if it works for you...

c = Replace(Replace(c, " ", ""), Chr(160), "")

--
Rick (MVP - Excel)


"J.W. Aldridge" wrote in message
...
Got this code....

Doesnt always work for some reason. Any alternate way to put this? (Or
is something wrong with it?)


Sub eat_spaces()

Dim c As Range
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For Each c In Range("G2:T1500")

c = Replace(c, " ", "")
Next


Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub