View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Cheetahke Cheetahke is offline
external usenet poster
 
Posts: 20
Default Calculate week from current day

Hello Robert,

you can use the function "Weekday"

Dim MyDate, MyWeekDay, Day1, Day2, Day3, Day4, Day5, Day6, Day7
MyDate = #12 februari 1969#
MyWeekDay = Weekday(MyDate)

Select case MyWeekDay
case 1
Day1 = MyDate
Day2 = MyDate + 1
Day3 = MyDate + 2
(and so on)
case 2
Day1 = MyDate - 1
Day2 = MyDate
Day3 = MyDate + 1
....
case 3
Day1 = MyDate - 2
....
case 4
....
end Select

"Robert Crandal" wrote:

This is probably an easy question, but i'll ask anyhow:

One of my subroutines is passed the current date in "mm-dd-yy"
format. For example, it would pass in a value of "12-04-09"
for today's date.

I now need some code that will give me the Sunday to Saturday
date range that coincides with the current date. Therefore,
the code should give me a start date of "11-29-09" and end
date of "12-05-09" because "12-04-09" is part of that week.

thanx again

.