View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default How to automatically goto to today's date

Sorry, I errored, it should be

Private Sub Workbook_Open()
With ThisWorkbook.Worksheets(Format(Date, "mmm"))
.Activate
.Range("B" & Day(Date) + 1).Select
End With
End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Hans gmail" wrote in message
...
Dear Bob,

I tried your code as instructed but when I tried to re-open the workbook,

an
error message comes out - "Compile Error: Method or Data member not found"
and the Private Sub Workbook_Open words are highlighted yellow while the
.Range protion is highlighted in blue.

I have constructed my worksheet in such a way that I made a "Calendar" on
the side with cell G13 having the date Jan 01, 2007 and cell H13 as
Workday(G13,1); I13 as Workday(H13,1) up to K13. And G14 as Workday(K13,1)

up
to K14. Then same set of formula for G15 up to K15 and G16 to K16. I then
placed in cell C41 the formula +H13 to signify the date for that day's

list
of names that I need to input.

Hope things are clearer.


"Bob Phillips" wrote:

This code will select the worksheet assuming the format is Jan , Feb,

Mar,
etc., and then selects the row corresponding to the day + 1 (to allow

for
headings) and column B

Private Sub Workbook_Open()
With ThisWorkbook
.Worksheets(Format(Date, "mmm")).Activate
.Range("B" & Day(Date) + 1).Select
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Hans gmail" <Hans wrote in message
...
I have a worksheet where I type in lists of names on a daily basis. I

have
formatted the worksheet with the column headings and row numbers plus

the
calendar dates for the whole month (one worksheet for one month). How

can
i
make the cursor go to a specified date like "today's date" when I open

the
worksheet (instead of scrolling down to today's date)? Is it thru a

function
or macro? I highly appreciate any help anyone can offer.