B
bpotter
I am writing a macro in workbook_open
what I am wanting to do is search through my workbook for todays date
in a certain range.
then activate that workbook.
I currently have this code
Private Sub Workbook_Open()
Dim dates As Range
Dim cell As Range
Dim ws As Worksheet
Worksheets(Day(1)).Activate
For Each ws In Worksheets
On Error Resume Next
Worksheets(ws.Name).Activate
Set dates = Range("b3")
Set cell = dates.Find(Date)
If Not cell Is Nothing Then
cell.Activate
Exit For
End If
Next ws
End Sub
But it keeps giveing me the wrong sheet. It selects the last sheet in
the workbook.
Any help would greatly be appreciated.
what I am wanting to do is search through my workbook for todays date
in a certain range.
then activate that workbook.
I currently have this code
Private Sub Workbook_Open()
Dim dates As Range
Dim cell As Range
Dim ws As Worksheet
Worksheets(Day(1)).Activate
For Each ws In Worksheets
On Error Resume Next
Worksheets(ws.Name).Activate
Set dates = Range("b3")
Set cell = dates.Find(Date)
If Not cell Is Nothing Then
cell.Activate
Exit For
End If
Next ws
End Sub
But it keeps giveing me the wrong sheet. It selects the last sheet in
the workbook.
Any help would greatly be appreciated.