going to Today's date with a macro
hi
here's the code.
Private Sub CommandButton1_Click()
Dim d As Date
d = Date 'Today's date
Cells.Find(What:=d, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False).Activate
End Sub
But i don't know if you want it in a command button on the sheet or an icon
button on your tool bar. I would recomend a command button on the sheet
because command buttons follow the file. icon buttons don't.
the above is for a command button on the sheet. if you want an icon button,
then create your icon. paste the code in a standard module. change the name
to...oh.. sub FindToday() then attach the module to the icon.
the above worked on my machine. running xp.
hope this helped
Regards
FSt1
"Jim" wrote:
Hi
I have a database with ten years of dates in column A. Is there a
simple macro I could write that would go to the row with today's date. I
just want to be able to click on a "Today" button that will run the macro
that goes to the row containing today's date. Thanks Jim
|