From: Michaelcip on 27 May 2010 15:53 Thanks Graham, I recognize this as VBA, but don't know where/how to do this. I think if you give me simple instructions I can navigate through it enough. Also just to clarify, what I'm after is (w/ today being the 27th) I'd like this cell to populate w/ the date "5/30/2010" (& if it were the 25th, it would still populate w/ "5/30/2010") Many thanks, MC "Graham Mayor" wrote: > Something along the lines of > > Dim sDate As Date > Dim i As Long > sDate = InputBox("Date today", , Date) > i = WeekDay(sDate) - 1 > Selection.TypeText sDate - i > > will type the date of the previous Sunday at the cursor. > > If you want to use today's date as the start point instead of the input box > then use > > sDate = Date > in place of > sDate = InputBox("Date today", , Date) > > -- > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > Graham Mayor - Word MVP > > My web site www.gmayor.com > Word MVP web site http://word.mvps.org > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > > > > "Michaelcip" wrote: > > > 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
From: Graham Mayor on 27 May 2010 16:36 Something along the lines of Dim sDate As Date Dim i As Long sDate = InputBox("Date today", , Date) i = WeekDay(sDate) - 1 Selection.TypeText sDate - i will type the date of the previous Sunday at the cursor. If you want to use today's date as the start point instead of the input box then use sDate = Date in place of sDate = InputBox("Date today", , Date) -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "Michaelcip" wrote: > 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
From: Doug Robbins - Word MVP on 27 May 2010 17:07 See the following page of Graham's website: http://www.gmayor.com/installing_macro.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Michaelcip" <Michaelcip(a)discussions.microsoft.com> wrote in message news:07DA8245-1CE1-48B3-B718-492C1026E625(a)microsoft.com... > Thanks Graham, I recognize this as VBA, but don't know where/how to do > this. > I think if you give me simple instructions I can navigate through it > enough. > > Also just to clarify, what I'm after is (w/ today being the 27th) I'd like > this cell to populate w/ the date "5/30/2010" (& if it were the 25th, it > would still populate w/ "5/30/2010") > > Many thanks, MC > > "Graham Mayor" wrote: > >> Something along the lines of >> >> Dim sDate As Date >> Dim i As Long >> sDate = InputBox("Date today", , Date) >> i = WeekDay(sDate) - 1 >> Selection.TypeText sDate - i >> >> will type the date of the previous Sunday at the cursor. >> >> If you want to use today's date as the start point instead of the input >> box >> then use >> >> sDate = Date >> in place of >> sDate = InputBox("Date today", , Date) >> >> -- >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> >> Graham Mayor - Word MVP >> >> My web site www.gmayor.com >> Word MVP web site http://word.mvps.org >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> >> >> >> >> "Michaelcip" wrote: >> >> > 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
|
Pages: 1 Prev: Word font color keyboard shortcut Next: Using function IF in WORD 2003 |