View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Joe HM Joe HM is offline
external usenet poster
 
Posts: 92
Default Removing spaces from value using VBA

Darn ... I must be stupid ... here we go ...
rangename = Replace(rangename, " ", "")

Sorry about that ...
Joe



Joe HM wrote:
Hello -

You can use the following ...
rangename = Instr(rangename, " ", "")

Joe



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