Interesting VBA Question


Posted by Julio on October 26, 2000 3:24 PM


Does anyone know, is it possible to concatenate a
variable?

I know it might sound strange to attempt this, but
I feel it would be really convenient; for ex.

Month1 = "Jan"
Month2 = "Feb"

n= Range("c19") -A Range containing the number
result of a ComboBox-

ActualMonth = Month & n

...and here is where I need help...

How do you tell VBA that the result of joining the
two is a variable called Month1 or Month2, and not
Month plus the value of "n"...

I know you can attempt to this with IF's but it's
way longer!

Anyways, Thanks in advance for all your help!


Regards,

Posted by Tim Francis-Wright on October 27, 2000 10:02 AM

I think there's an easier way to do this:
set up an array called Month--

Dim Month(12) as String
Month(1) = "Jan"
Month(2) = "Feb"
[etc.]
n = Range("C19")
ActualMonth = Month(n)

HTH



Posted by Julio on October 27, 2000 2:50 PM

Tim:

Thanks for your reply,

This is EXACTLY the solution I was looking
for (just proves how much I still have to learn
about VBA).

Anyways, I tried it and it works great!


Thanks!

Julio