help with string functions

  • Thread starter Thread starter margie
  • Start date Start date
M

margie

I need some help with string functions. Let's say I have a set o
numbers from 1 to n. (1,2,3,4,...n). the user will input what th
value of n will be. the program will then create the string of number
from 1 to n. I've been playing around with the mid function but tha
requires an initial defined string. Is there any way to create thi
string of numbers without an initial defined string?

example:

user defines n=9

string = 123456789

thanks
 
Hi Margie,

Try this

For i = 1 to n
myString = myString & i
Next i

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
margie,

Here is one way...

'------------------------------
Sub MakeNumbers()
Dim strNumbers As String
Dim lngNum As Long
Dim lngCounter As Long

'A limit should be placed on the value of lngNum
'Also, check to make sure that a numeric value was entered
lngNum = 99

For lngCounter = 1 To lngNum
strNumbers = strNumbers & CStr(lngCounter)
Next
MsgBox strNumbers
End Sub
'------------------------------

Regards,
Jim Cone
San Francisco, CA
 
Back
Top