Trim Function

B

Bill

Hi everybody

I am trying to use a macro to trim a selected range
but I can't seem to get it to function - the code
looks like this
Range("A2:R600").Select
Dim MyString, TrimString
MyString = " <-Trim-> "
TrimString = Trim(MyString)
TrimString = "<-Trim->"
End sub

I would be grateful for any suggetsions on how I can get
this to work


Thanks in anticipation


Bill
 
A

Andy Pope

Hi Bill,

Try this,

Dim rngTemp As Range
For Each rngTemp In Range("A2:R600")
rngTemp.Value = Trim(rngTemp.Value)
Next

Cheers
Andy
 

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

Top