Cindy75
asked on
Create a variable within the subroutine
I need code to create multiple variables from the subroutine. I need to create DS1 - DS40. Those need to be the variable names, but I'd like the program to create them without having to type them all in. If I know how to do this, I can apply it to multiple programs.
For T = 1 to 40
DS(T) = rnd *10
Next T
I need the program to create variables based on a counter. These variables have to be declared as single. I would like the simplest way to do this.
For T = 1 to 40
DS(T) = rnd *10
Next T
I need the program to create variables based on a counter. These variables have to be declared as single. I would like the simplest way to do this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hearing...
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- answered by ameba
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
twalgrave
Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
- answered by ameba
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
twalgrave
Cleanup Volunteer
per recommendation
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod
Community Support Moderator @Experts Exchange
Dim numVars As Integer
Dim i As Integer
numVars = 40
Dim DS() As Single
ReDim DS(1 To numVars)
For i = 1 To UBound(DS)
DS(i) = Rnd * 10
Next