View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Go to current date upon opening Worksheet

Jason

Macro written by Ron deBruin.......with slight modifications.

Copy/paste to a General Module.

Sub Find_Todays_Date()
Dim FindString As Date
Dim rng As Range
FindString = Date
With ActiveSheet.Range("A:A")
Set rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Application.Goto rng, True
Else
MsgBox "Nothing found"
End If
End With
End Sub

Place the following in the sheet module.

Private Sub Worksheet_Activate()
Call Find_Todays_Date
End Sub

BTW..........A is not a row. A is a column.


Gord Dibben MS Excel MVP

On Thu, 17 Aug 2006 18:39:01 -0700, Jason
wrote:

How would I go about making a script to automatically find and select today's
date when I activate the worksheet (not the workbook)?

I have dates in row A and I want to search for today's date and
automatically go that cell when I click on the worksheet's tab. The
worksheet is called "Order Fulfillment".