Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
month according to numbers
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
month according to numbers
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")) In article , 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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
month according to numbers
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 ----- 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. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
month according to numbers
If you're using xl2002 (or higher):
MsgBox UCase(MonthName(3, abbreviate:=True)) 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. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Count numbers of Month in a cell | Excel Worksheet Functions | |||
Counting numbers of date within a spesific month | Excel Discussion (Misc queries) | |||
Converting numbers to month names | Excel Discussion (Misc queries) | |||
Change Month (words) to (numbers) | Excel Worksheet Functions | |||
Count a numbers of entries in a given month ? | New Users to Excel |