Populating the last Sun. date of that week in a cell

M

Michaelcip

Thanks in advance.
I'm using Word 2003 & I'd like to populate a cell of a table to fill in the
last Sunday-DATE of that week. This is for a timesheet.doc where that date
needs to be filled in for our Payroll Dept. Currently folks are having to go
to a calendar & look up in order to manually populate this field. Many
thanks, MC
 
G

Graham Mayor

If you want NEXT Sunday then you will need to change the code to

Sub NextSunday()
Dim sDate As Date
Dim i As Long
sDate = Date
i = 8 - WeekDay(sDate)
Selection.TypeText sDate + i
End Sub

You will need to run the macro from a toolbar button or keyboard shortcut
see http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
M

Michaelcip

Will try this. Thanks to both Doug & Graham for your imput. Have a great
holiday weekend! Michaelcip
 
M

Michaelcip

Thank-you very, very much for your input "macropod" I will look @ this now. MC

macropod said:
Hi Michaelcip,

To see how to do this and just about everything else you might want to do with dates in Word, check out my Microsoft Word Date
Calculation Tutorial, at:
http://lounge.windowssecrets.com/index.php?showtopic=249902
or
http://www.gmayor.com/downloads.htm#Third_party
In particular, look at the item titled 'Calculate a Stepped Date'. Do read the document's introductory material.

--
Cheers
macropod
[Microsoft MVP - Word]


Michaelcip said:
Thanks in advance.
I'm using Word 2003 & I'd like to populate a cell of a table to fill in the
last Sunday-DATE of that week. This is for a timesheet.doc where that date
needs to be filled in for our Payroll Dept. Currently folks are having to go
to a calendar & look up in order to manually populate this field. Many
thanks, MC

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top