View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default String concatenation

Use

Sname = Sname & "START_" & Str(i) & ", "


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"shishi" wrote in message
oups.com...
Hi,

Is there a better way to concatenate strings in excel vba.
The below code is not giving me the desired results. Could you
please
tell what could be the reason?

For i = 1 To nmodules

Sname = "START_" & Str(i)
MsgBox "The String is " & Sname
Next i

The result is
START_<space1
START_<space2 .....and so on

Excel is placing a space between the arguments. The desired
results is
START_1, START_2 etc.

shi