View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Week Ending Formula

Dim dt as Date
if weekday(date,vbSunday) = 2 then
with worksheets("dump")
dt = date - 2
for i = 1 to 7
.cells(i,1).Value = dt + i - 1
.cells(i,1).Numberformat = "mm/dd/yyyy"
Next
End With
End if

--
Regards,
Tom Ogilvy


"Jako " wrote in message
...
Could someone please tell me if there is a formula to do the following.

I have a formula which puts todays day in DayTextBox.
I have a formula which puts todays Date in DayTextBox.

What i want to do is then put in WeekEndDayTextBox and
WeekEndDateTextBox with the obvious data.

The weekending day will be a friday. I want to do this on a Monday so i
need to check if today is Monday if it is then i want to set (on
Worksheet "DUMP") cell A1 as Monday-2 (ie Saturday),
cell a2 as Monday-1 (ie Sunday) etc until A7 as Monday+5 (ie Friday).

All controls are on a userform (VBA).

Is this possible?

As mentioned i only want to allocate the data to the worksheet on a
Monday.

TIA


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