Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default go to today's date

Hi and thanks for the help. I am using Excel 2003. I have a spread sheet that
holds the date for every day of the year. I would like to create a macro that
takes me to the current date on the sheet every time I open the workbook.

I know that in Access that macro is named AutoExec and in Word it is called
AutoOpen but I don't know what to call it in Excel to automatically run the
macro when the workbook is opened.

I don't have any idea how to make the macro find the current date. If you
put code in here please go easy on me. I don't ever do any code. My worksheet
name is 2006. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default go to today's date

I'm guessing that the worksheet name is Sheet1 and the dates are in column A.

Option Explicit
Sub Auto_Open()

Dim Res As Variant
Dim Wks As Worksheet

Set Wks = Worksheets("sheet1")

With Wks
Res = Application.Match(CLng(Date), .Range("a:a"), 0)
If IsError(Res) Then
MsgBox "Date not found"
Else
Application.Goto Wks.Range("a:a")(Res), scroll:=True
End If
End With

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

SheriTingle wrote:

Hi and thanks for the help. I am using Excel 2003. I have a spread sheet that
holds the date for every day of the year. I would like to create a macro that
takes me to the current date on the sheet every time I open the workbook.

I know that in Access that macro is named AutoExec and in Word it is called
AutoOpen but I don't know what to call it in Excel to automatically run the
macro when the workbook is opened.

I don't have any idea how to make the macro find the current date. If you
put code in here please go easy on me. I don't ever do any code. My worksheet
name is 2006. Thanks.


--

Dave Peterson
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
conditional formatting for cell date to equal today's date Sistereinstein Excel Worksheet Functions 2 September 10th 12 07:53 PM
date in Cell to change colors if the date is beyond today's date Pete Elbert Excel Discussion (Misc queries) 2 June 6th 09 06:31 AM
How to use Today's date in a cell and make it stay the same date ADSK Excel Discussion (Misc queries) 6 November 17th 08 07:34 PM
I need today's date returned as date format in formula CMIConnie Excel Discussion (Misc queries) 2 February 23rd 06 04:38 PM
Count number of cells with date <today's date Cachod1 New Users to Excel 2 January 28th 06 02:37 AM


All times are GMT +1. The time now is 03:55 AM.

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"