On open select worksheet by day of month

  • Thread starter Thread starter sylv1501
  • Start date Start date
S

sylv1501

I have a workbook with sheets numbered 1-31 for each day of the month.
How can I program this to open on the sheet for the current day?
 
Use the workbook open event in the ThisWorkbook module.
Convert today's date to a string and use that as the workbook name.
'--
Private Sub Workbook_Open()
ThisWorkbook.Worksheets(CStr(Day(Date))).Select
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




<[email protected]>
wrote in message
I have a workbook with sheets numbered 1-31 for each day of the month.
How can I program this to open on the sheet for the current day?
 
Place this in the workbook open section
Worksheets(Format(Date, "dd")).Activate
Best wishes
Graham F
 
I have a workbook with sheets numbered 1-31 for each day of the month.
How can I program this to open on the sheet for the current day?

Place this in "ThisWorkbook"

Private Sub Workbook_Open()
Dim DayOfMonth As String
DayOfMonth = Day(Now())
Worksheets(DayOfMonth).Select
End Sub
 
Back
Top