On open goto today

N

Nemo

I have a work book that has 3 work sheets. One sheet has year 2009 listed as
dates in colum A, i was a able to conditional format this sheet to high lite
todays date. question is when i open this sheet , i want to automaticaly
goto the row that is todays date? Any sugestion would be apreciated.
 
D

Don Guillett

Right click sheet tab>view code>insert this

Private Sub Worksheet_Activate()
mydate = Date
columns(1).Find(What:=mydate, LookIn:=xlFormulas, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
End Sub
 
G

Gary''s Student

This assumes that the tab name containing the list of dates is 2009. In the
workbook code area, insert the following event macro:

Private Sub Workbook_Open()
Sheets("2009").Activate
Dim d As Date
d = Date
For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If Cells(i, 1).Value = d Then
Cells(i, 1).Select
Exit Sub
End If
Next
End Sub

Because it is workbook code, it is very easy to install and use:

1. right-click the tiny Excel icon just to the left of File on the Menu Bar
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (workbook code), see:

http://www.mvps.org/dmcritchie/excel/event.htm
 

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