hi,
if you remember me from yesterday, you know i don't have much experience with vba and i'm a c++ person..
i remember doing somethign strange in vba a few years ago.. something that i know you can't do in c++. i somehow managed to use a string that started with a letter of the alphabet and appended a number to it. then i was able to use variables of the same name.. and access them through the string. do you know how i can do that? would make my life easier.
example:
that for loop i have is not correct.. ie it works, but it doesn't do what i want it to do.. every time i get temp to hold a value like "k1" or "k2" i want to be able to access the long declared in the first few lines of code.
is this possible? i remember doing it in access... i'm using excel now tho.. don't think that should make a diff..
thanks!
ps. if i'm mistaken about this, i won't be surprised! because i know you can't do it in other languages that i use!
if you remember me from yesterday, you know i don't have much experience with vba and i'm a c++ person..
i remember doing somethign strange in vba a few years ago.. something that i know you can't do in c++. i somehow managed to use a string that started with a letter of the alphabet and appended a number to it. then i was able to use variables of the same name.. and access them through the string. do you know how i can do that? would make my life easier.
example:
Code:
Sub test()
Dim k1 As Integer
Dim k2 As Integer
Dim k3 As Integer
Dim temp As String
k1 = 11
k2 = 22
k3 = 33
temp = "k"
For i = 1 To 3
temp = temp + CStr(i)
MsgBox (temp)
temp = "k"
Next i
End Sub
that for loop i have is not correct.. ie it works, but it doesn't do what i want it to do.. every time i get temp to hold a value like "k1" or "k2" i want to be able to access the long declared in the first few lines of code.
is this possible? i remember doing it in access... i'm using excel now tho.. don't think that should make a diff..
thanks!
ps. if i'm mistaken about this, i won't be surprised! because i know you can't do it in other languages that i use!