Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count numbers of Month in a cell Navarat Mishra Excel Worksheet Functions 4 February 23rd 09 11:34 AM
Counting numbers of date within a spesific month Kriss Excel Discussion (Misc queries) 3 November 6th 08 12:44 PM
Converting numbers to month names Charles Excel Discussion (Misc queries) 6 October 10th 08 06:00 PM
Change Month (words) to (numbers) Cathy Excel Worksheet Functions 11 May 28th 06 02:12 PM
Count a numbers of entries in a given month ? Svoger New Users to Excel 4 April 5th 05 12:52 AM


All times are GMT +1. The time now is 06:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"