Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro and Today's Date Antonius Excel Programming 5 August 9th 07 03:22 PM
Macro to jump to today's date Victor Delta Excel Discussion (Misc queries) 9 July 4th 06 08:52 PM
set cell to today's date macro Colm O'Brien Excel Programming 3 May 28th 04 11:56 AM
Macro to filter on today's date Mike Boardman Excel Programming 2 October 3rd 03 01:49 AM
Macro to filter on today's date Mike B[_4_] Excel Programming 0 October 1st 03 09:17 AM


All times are GMT +1. The time now is 04:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"