Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calulating the last sayurday of a week using vba
I am trying to write a formula, using vba to give me the date of the last
saturday from 'Today's date'. For example, if today is Monday, what is the date of last saturday.... Any ideas? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calulating the last sayurday of a week using vba
Assume the date you're using as the start point is stored
in variable x, then: y = x - (weekday(x) + 1) will give you last Saturday's date in y, assuming you haven't changed the FirstDayofWeek constant from Sunday. Cheers, Pete -----Original Message----- I am trying to write a formula, using vba to give me the date of the last saturday from 'Today's date'. For example, if today is Monday, what is the date of last saturday.... Any ideas? . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calulating the last sayurday of a week using vba
Hi, Pete:
Your code as written gives ME the previous Friday, not Saturday. You don't want to add 1 here. i.e. it should be just y = x - Weekday(x) Myrna Larson On Fri, 15 Aug 2003 09:03:35 -0700, "Pete McCosh" wrote: Assume the date you're using as the start point is stored in variable x, then: y = x - (weekday(x) + 1) will give you last Saturday's date in y, assuming you haven't changed the FirstDayofWeek constant from Sunday. Cheers, Pete -----Original Message----- I am trying to write a formula, using vba to give me the date of the last saturday from 'Today's date'. For example, if today is Monday, what is the date of last saturday.... Any ideas? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with calulating Null fields | Excel Worksheet Functions | |||
Calulating week # & Day # | Excel Worksheet Functions | |||
Calulating hours, minutes and seconds | Excel Worksheet Functions | |||
reducing Calulating time | Excel Discussion (Misc queries) | |||
Calulating Age Formula | Excel Worksheet Functions |