Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Dynamically declaring variables with composite name

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Dynamically declaring variables with composite name

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Dynamically declaring variables with composite name

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
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
Declaring variables for use in multiple worksheets tompl Excel Discussion (Misc queries) 0 April 8th 10 04:40 PM
Declaring variables freekrill Excel Discussion (Misc queries) 2 July 19th 06 06:36 AM
Declaring variables freekrill Excel Discussion (Misc queries) 0 July 18th 06 06:15 PM
Declaring Variables chris brunt Excel Programming 2 August 4th 03 02:02 PM
Declaring Global Variables skmr3 Excel Programming 1 July 14th 03 05:54 AM


All times are GMT +1. The time now is 03:02 PM.

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"