month according to numbers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi ,

lets say I have set X = 1 and I want this to become x=JAN , y=2 to y=FEB, .... I know I can do this through the textocolumn but my problem is that these are variables in my macro and not cells in the worksheet.

Is there a way I could achieve this ??
Thanks for your help.
 
One way:

Dim x As Variant
Dim y As Variant
x = 1
y = 2
x = UCase(Application.GetCustomListContents(3)(x))
y = UCase(Application.GetCustomListContents(3)(y))

Another:

Dim x As Variant
Dim y As Variant
x = 1
y = 2
x = UCase(Format(DateSerial(1, x, 1), "MMM"))
y = UCase(Format(DateSerial(1, y, 1), "MMM"))
 
See the following simple example
It uses "FORMAT" to convert a date into a format of "mmm", which shows only the month of a date in the format of "Jan", "Feb", etc

Sub example(
Dim
x =
x = Format(DateSerial(2003, x, 1), "mmm"
MsgBox
End Su

Regards
Edwin Ta
(e-mail address removed)


----- douvid wrote: ----

Hi ,

lets say I have set X = 1 and I want this to become x=JAN , y=2 to y=FEB, .... I know I can do this through the textocolumn but my problem is that these are variables in my macro and not cells in the worksheet.

Is there a way I could achieve this ??
Thanks for your help.
 
Back
Top