View Single Post
  #5   Report Post  
Peter Rooney
 
Posts: n/a
Default

Sorry, I forgot you wanted to run it whenever the workbook opened!

Paste this code into the code window of your "ThisWorkbook" in the Visual
Basic Editor. make sure you don't change the procedure name, otherwise it
won't work.

Private Sub Workbook_Open()

Dim SearchCell As Object

For Each SearchCell In Range("SearchDates")
If SearchCell.Value = Date Then
SearchCell.Select
Exit Sub
End If
Next SearchCell
End Sub

In this way, the code will run whenever you open the workbook. I'm sure you
know, but you can also have similar macros called:
Private Sub Workbook_Close() which runs when the workbook closes, or

Private Sub Worksheet_Activate() or
Private Sub Worksheet_Deactivate()

in the code windows of your worksheets to run when a worksheet is activated
or deactivated.

Hope this helps

Pete





"R VAN DEURSEN" wrote:

I have a worksheet with the dates of a month, say 1jan,
2jan, 3jan etc. Is there a way that excel by opening the
workbook selects automaticely the current date.