Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
going to Today's date with a macro
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro and Today's Date | Excel Programming | |||
Macro to jump to today's date | Excel Discussion (Misc queries) | |||
set cell to today's date macro | Excel Programming | |||
Macro to filter on today's date | Excel Programming | |||
Macro to filter on today's date | Excel Programming |