Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 " wrote in message ... I need some help with string functions. Let's say I have a set of numbers from 1 to n. (1,2,3,4,...n). the user will input what the value of n will be. the program will then create the string of numbers from 1 to n. I've been playing around with the mid function but that requires an initial defined string. Is there any way to create this string of numbers without an initial defined string? example: user defines n=9 string = 123456789 thanks. --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 "margie " wrote in message ... I need some help with string functions. Let's say I have a set of numbers from 1 to n. (1,2,3,4,...n). the user will input what the value of n will be. the program will then create the string of numbers from 1 to n. I've been playing around with the mid function but that requires an initial defined string. Is there any way to create this string of numbers without an initial defined string? example: user defines n=9 string = 123456789 thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
help with string functions please | New Users to Excel | |||
String functions in VB macro | Excel Discussion (Misc queries) | |||
String of functions confusion - please help | Excel Discussion (Misc queries) | |||
STRING functions | Excel Worksheet Functions | |||
Return two mid functions as one string. | Excel Programming |