Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, Ive got 20 variables named xmean1, xmean2,
xmean3............xmean20. I want to refer to these with, For I = 1 TO 20. Ive tried, xmean(i), xmean & i and (xmean(i)). Any idea on how to do this, or is this not possible. Regards Robert |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I would think you need to place the xmean variables in an array i.e dim xmean(1 to 20) They can then be referenced in a loop with xmean(i), i being the loop variable. Don wrote in message ups.com... Hi, Ive got 20 variables named xmean1, xmean2, xmean3............xmean20. I want to refer to these with, For I = 1 TO 20. Ive tried, xmean(i), xmean & i and (xmean(i)). Any idea on how to do this, or is this not possible. Regards Robert |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Create an array of variables
Dim xmean(1 to 20) ... load the array For i = 1 To 20 Debug.Pring xmean(i) Next i -- HTH Bob Phillips (remove nothere from email address if mailing direct) wrote in message ups.com... Hi, Ive got 20 variables named xmean1, xmean2, xmean3............xmean20. I want to refer to these with, For I = 1 TO 20. Ive tried, xmean(i), xmean & i and (xmean(i)). Any idea on how to do this, or is this not possible. Regards Robert |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thankyou for your replys, this is perfect. Can I use the same for a
static variable. ie Static xmean as integer. Thanks Again Regards Robert |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes you can but you need to size it in the declaration, and also Integer is
really redundant in 32 bit systems Static xmean(1 To 20) As long -- HTH Bob Phillips (remove nothere from email address if mailing direct) wrote in message ups.com... Thankyou for your replys, this is perfect. Can I use the same for a static variable. ie Static xmean as integer. Thanks Again Regards Robert |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for your advice, much appreciated.
Regards Robert |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry, just realised another part to this. Ive been using Erase xmean1,
how do I use this with a loop, eg for i = 1 to 20 Erase(i) next i. Triead this but didnt work Regards Robert |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions | |||
Run-time error '91': "Object variable or With block variable not set | Excel Programming | |||
setting a range variable equal to the value of a string variable | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming | |||
Pivot Table - Object variable or with block variable not set? | Excel Programming |