LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default String concatenation

Shi,

I think Chip may have gone to dinner...

The "Str" function automatically adds a space to contain the sign of the number.
The "Cstr" function would work for you, however it is not required.
The "&" operator will convert the i variable to a string so,
assuming that Sname is a String...

Sname = "START_" & i

is all you need.

Jim Cone
San Francisco, USA



"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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help With String Concatenation Rick Rothstein Excel Worksheet Functions 6 September 15th 11 10:42 PM
Need Help With String Concatenation Xt Excel Worksheet Functions 1 September 15th 11 09:47 PM
Bold in string concatenation Steen Excel Discussion (Misc queries) 12 November 7th 06 12:49 AM
How do I put each member of string concatenation in its own line? DViolette Excel Worksheet Functions 3 July 8th 05 02:08 AM
string concatenation Mike NG Excel Programming 2 August 15th 03 03:06 AM


All times are GMT +1. The time now is 01:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"