Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to set up a loop which creates variables of type integer
with a composite name created from a list of values held in an array (of type string) and a fixed piece of text. To illustrate, this is the sort of code I'm coming up with, which of course doesn't work..... For n = 0 To UBound(aryFundList, 2) ActiveSheet.Cells(1, 1).Value = aryFundList(0, n) & "stop" Dim ActiveSheet.Cells(1, 1).Value As Integer Next Can anyone offer some advice? Thanks, Al |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Al, it's not possible to explicitly declare variables like
this. i think the best you can do is to set up a collection, where the objects within have keys = the value within your cell. eg dim clsMyObject as YourClass dim colTemp as new collection For n = 0 To UBound(aryFundList, 2) ActiveSheet.Cells(1, 1).Value = aryFundList(0, n) & "stop" set clsMyObject=new YourClass colTemp.add clsMyObject,aryFundList(0, n) & "stop" Next Regards Rog -----Original Message----- I would like to set up a loop which creates variables of type integer with a composite name created from a list of values held in an array (of type string) and a fixed piece of text. To illustrate, this is the sort of code I'm coming up with, which of course doesn't work..... For n = 0 To UBound(aryFundList, 2) ActiveSheet.Cells(1, 1).Value = aryFundList(0, n) & "stop" Dim ActiveSheet.Cells(1, 1).Value As Integer Next Can anyone offer some advice? Thanks, Al . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rog,
Thanks for this. Can you tell me which reference(s) I need to have selected from the VBE Tools - References menu for YourClass to be available? Thanks again, Al "Rog" wrote in message ... Al, it's not possible to explicitly declare variables like this. i think the best you can do is to set up a collection, where the objects within have keys = the value within your cell. eg dim clsMyObject as YourClass dim colTemp as new collection For n = 0 To UBound(aryFundList, 2) ActiveSheet.Cells(1, 1).Value = aryFundList(0, n) & "stop" set clsMyObject=new YourClass colTemp.add clsMyObject,aryFundList(0, n) & "stop" Next Regards Rog -----Original Message----- I would like to set up a loop which creates variables of type integer with a composite name created from a list of values held in an array (of type string) and a fixed piece of text. To illustrate, this is the sort of code I'm coming up with, which of course doesn't work..... For n = 0 To UBound(aryFundList, 2) ActiveSheet.Cells(1, 1).Value = aryFundList(0, n) & "stop" Dim ActiveSheet.Cells(1, 1).Value As Integer Next Can anyone offer some advice? Thanks, Al . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Declaring variables for use in multiple worksheets | Excel Discussion (Misc queries) | |||
Declaring variables | Excel Discussion (Misc queries) | |||
Declaring variables | Excel Discussion (Misc queries) | |||
Declaring Variables | Excel Programming | |||
Declaring Global Variables | Excel Programming |