TRIM Macro

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top