TRIM Macro

  • Thread starter Thread starter Danny
  • Start date Start date
D

Danny

Can somebody help me write a macro to TRIM extra spaces? I
tried the example in the built excel help (see below) but
it won't work. I need the macro if I hightlight a range or
highlight the entire worksheet.

Dim MyString, TrimString
MyString = " said:
TrimString = RTrim(MyString) ' TrimString = " <-Trim-
TrimString = LTrim(RTrim(MyString)) ' TrimString = "<-
Trim->".
' Using the Trim function alone achieves the same result.
TrimString = Trim(MyString) ' TrimString = "<-Trim->".

Thanks in advance.
 
Back
Top