Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi All, I want some help regarding date function in macro. I want to know th week day number of the date. For eg on 30/12/2005 its Friday. I want th week day number. For eg Sunday -1 ,Monday -2 .... Friday -6 Saturday 7. For 30/12/2005, the result will be 6. Is there any function to get th week day number? Regards Ashis -- ashishpre ----------------------------------------------------------------------- ashishprem's Profile: http://www.excelforum.com/member.php...fo&userid=3148 View this thread: http://www.excelforum.com/showthread.php?threadid=53216 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
this should do it, i used a1 for the date and b1 for the result
Sub test() Range("b1").Value = Weekday(Range("a1")) End Sub just for reference, if you wanted monday for the first day of the week, then you would use this and the value would be 5 Range("b1").Value = Weekday(Range("a1"), vbMonday) -- Gary "ashishprem" wrote in message ... Hi All, I want some help regarding date function in macro. I want to know the week day number of the date. For eg on 30/12/2005 its Friday. I want the week day number. For eg Sunday -1 ,Monday -2 .... Friday -6 Saturday - 7. For 30/12/2005, the result will be 6. Is there any function to get the week day number? Regards Ashish -- ashishprem ------------------------------------------------------------------------ ashishprem's Profile: http://www.excelforum.com/member.php...o&userid=31485 View this thread: http://www.excelforum.com/showthread...hreadid=532162 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excel worksheet formula WEEKDAY yields the value you require e.g.
=WEEKDAY(A1,1) The same can be used in VBA code e.g. MyDOW = Weekday(Range("A1"),1) -- Cheers Nigel "ashishprem" wrote in message ... Hi All, I want some help regarding date function in macro. I want to know the week day number of the date. For eg on 30/12/2005 its Friday. I want the week day number. For eg Sunday -1 ,Monday -2 .... Friday -6 Saturday - 7. For 30/12/2005, the result will be 6. Is there any function to get the week day number? Regards Ashish -- ashishprem ------------------------------------------------------------------------ ashishprem's Profile: http://www.excelforum.com/member.php...o&userid=31485 View this thread: http://www.excelforum.com/showthread...hreadid=532162 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Convert regular Date to Week Ending or Week Beginning Dates | Excel Discussion (Misc queries) | |||
Display "this week" column headers w/date & day of week? | Excel Worksheet Functions | |||
Date Function formula that will return the date of a specific week | Excel Worksheet Functions | |||
Finding the Monday date based on a different date in same week | Excel Worksheet Functions | |||
I need week number in excell from a date, first week must be mini. | Excel Discussion (Misc queries) |