View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jako[_45_] Jako[_45_] is offline
external usenet poster
 
Posts: 1
Default Get Date today from WeekEnding

I have adapted some code from Tom Ogilvy that is processed at Workshee
Open. It gives me the weekend date "dWeekEnding".(Which for m
application is a Friday).

Dim dt As Date
Dim dWeekEnding As Variant

If Weekday(Date, vbSunday) = 2 Then
dt = Date + 4
dWeekEnding = Format(dt, "dd.mm.yyyy")
End If

What i want to do (But can't) is find a way to get the dates for Monda
- Friday into variables (With the format "dd.mm.yyyy"):

Day1Date(Mondays Date)
Day2Date(Tuesdays Date)
Day3Date(Wednesdays Date)
Day4Date(Thursdays Date)
Day5Date(FridaysDate)

So if dWeekEnding = "23.07.2004" i want
Day1Date ="19.07.2004"
Day2Date ="20.07.2004" etc.

I want them to be defined at worksheet open (So incorparated into th
code above) and then to be available in any Procedure in m
application. (I have tried making dWeekEnding "Public" but just got a
error about a mismatch).

Please can someone suggest a way to do this.

Many thanks

--
Message posted from http://www.ExcelForum.com