Open excel file to current date.

  • Thread starter Thread starter K. Weaver
  • Start date Start date
K

K. Weaver

I have an excel spreadsheet I use for a employee work
schedule. I want to have the file open to the current
date. The dates are located in column B.
 
One way:

Option Explicit
Sub auto_open()

Dim res As Variant

With Worksheets("sheet1")
res = Application.Match(CLng(Date), .Range("b:b"), 0)
If IsError(res) Then
MsgBox "today wasn't found"
Else
Application.Goto .Range("b:b")(res), scroll:=True
End If
End With

End Sub
 
Back
Top