View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jeremy Jeremy is offline
external usenet poster
 
Posts: 184
Default Substitute() & Char() in Macro

I am trying to write a macro to remove white space in my excel spreadsheet. I
have following script but it says my sub or function not defined, but if I
use it in excel (not macro) it actually works. Any idea? Thanks.

Sub WhiteSpaceRemover()

Application.ScreenUpdating = False

For Each cell In Selection
cell.Value = Trim(Substitute(cell.Value, CHAR(160), CHAR(32)))
Next cell

End Sub