How to get one variable to equal the value of a changing variable (its hard to explain in the subjec

B

Bob

Dim CurrMenu as ???
Dim MenuNo As Integer
Dim Menu1ItemCount as Integer, Dim Menu2ItemCount as Integer

Menu1ItemCount = 1
Menu2ItemCount = 3
Menu3ItemCount = 5 etc

Do While MenuNo < whatever

MenuNo = 1

CurrMenu = "Menu" & Str(MenuNo) & "ItemCount" & ".Value"

MenuNo 1

Loop

What I'm trying to do is set CurrMenu to Menu1ItemCount (not the text
but the value of the variable). How do I do that? I've tried to put
words together so that it equals 'Menu1ItemCount.Value' but obviously
that does not work because it thinks its text, not the value 1 (the
value of the variable called Menu1ItemCount) as I'm trying to get.
Any suggestions?
 
T

tina

to assign the value of one variable to another variable, just write it as
"this variable = that variable", such as

varB = varA

now varB holds whatever value that varA holds. if you concatenate the value
of varA with a string, then you will most likely want to dim varB as a
String data type, as

Dim varB As String

varB = "something" & varA

hth
 
W

Walt Hall

Hi
I like what you are doing - but I bet MS has something against it - typical

You probably better off setting up an array
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top