Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help with string functions

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default help with string functions

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default help with string functions

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
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
help with string functions please KRK New Users to Excel 4 June 29th 09 12:36 PM
String functions in VB macro Aerojade Excel Discussion (Misc queries) 6 October 3rd 08 02:36 PM
String of functions confusion - please help Ashlee Excel Discussion (Misc queries) 2 November 10th 07 05:22 PM
STRING functions anar_baku Excel Worksheet Functions 4 November 8th 05 05:05 PM
Return two mid functions as one string. Keith Lorenzen Excel Programming 6 October 9th 03 02:46 PM


All times are GMT +1. The time now is 04:39 AM.

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"