MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Concantenation


Posted by Michael on December 27, 2001 12:35 PM

OK, This is probably rather simple, but I can't figure it out.

I need to define a variable as follows:
variable name = "GA" & Worksheet("Data Sheet").Cells(2,4).Number & Right(Worksheet("Data Sheet").Cells(3,4).Value,2)

Where the variable name is just that, the Cells call out is as follows(2,4) is a drop down list box containing the Months of the year (In Order) so that the number call out will return the numeric monthe (ie November = 11) and Cells (3,4) is a drop down box listing years (ie 2001, 2002, 2003, ...2030) so that the right function will give me the last two digits of the year. The end result should be GA1101, etc. The problem is that it doesn't work at all. I need this rather badly. Can Anybody Help Me Please.


Posted by Juan Pablo G. on December 27, 2001 12:44 PM

The expected result of this:

Worksheet("Data Sheet").Cells(2,4).Number

Is a "translation" of "November" to 11 ?

Does the dropdown list have everymonth ? (Jan - Dec) and nothing else ?

The Dropdown list returns a number ? or a string ?

Juan Pablo G.

Posted by Michael on December 27, 2001 12:50 PM

The .Value would give you November (a string). Yes the list has every month in order. (January thru December).

Posted by Juan Pablo G. on December 27, 2001 12:58 PM

Change

Worksheet("Data Sheet").Cells(2,4).Number

to

Month(DateValue("01/" & Worksheet("Data Sheet").Cells(2,4)))

Juan Pablo G.