Removing spaces from value using VBA
Jim, the reason wanted to see the formula in the cell is it may be possible
to re write it to fix the problem,
i.e. you could if it is looking up a reference trim from that ref point, you
could use find to find the space then use left function right function etc,
but it is hard to sort something without this, in other words fix it before
the macro not in the macro ? don't know if it was you want but just an idea
"Jim Thomlinson" wrote in message
...
Perhaps this will help... Note Application.Trim and Trim are different.
You
probably want application.substitute
Sub TrimTest()
Dim str As String
str = " This Is Only A Test "
MsgBox Trim(str)
MsgBox Application.Trim(str)
MsgBox Application.Substitute(str, " ", "")
End Sub
--
HTH...
Jim Thomlinson
"Barb Reinhardt" wrote:
Trim leaves ONE space. I'd like to use the SUBSTITUTE function, but am
not
sure how to add it to what I have. Suggestions?
Thanks,
Barb Reinhardt
"OZDOC" wrote:
look at the trim function it may help
"Barb Reinhardt" wrote in
message
...
I need to define a value for rangename. I have this working so far:
rangename = Workbooks(curbook).Worksheets(datasheet).Range("a" &
i).Value
Debug.Print rangename
Unfortunately, the range name has SPACES in it and when I use it to
create
a
named range, it GACKS. How do I remove the spaces from this?
Thanks,
Barb Reinhardt
|