Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default 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
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
Help with calulating Null fields Roderic Excel Worksheet Functions 3 August 11th 08 10:29 PM
Calulating week # & Day # bj[_2_] Excel Worksheet Functions 2 May 4th 07 02:48 PM
Calulating hours, minutes and seconds Linda Le Geyt Excel Worksheet Functions 5 November 9th 06 01:49 PM
reducing Calulating time harpscardiff Excel Discussion (Misc queries) 1 March 14th 06 12:26 PM
Calulating Age Formula YUMBUG Excel Worksheet Functions 3 August 26th 05 01:25 AM


All times are GMT +1. The time now is 11:13 PM.

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"