PDA

View Full Version : Excel - Opening the correct Month in a 12 sheet Workbook.



John W
14-08-2005, 02:24 PM
Ive a workbook, recording daily data for each month, each month having its own sheet. Its annoying to have to open the Workbook, then select the current month.

Any ideas on an Auto_Open macro that will go to the current month sheet?

Thanks.....John in Mosgiel.

Parry
14-08-2005, 06:45 PM
Hi John, Im assuming your sheets are named Jan, Feb etc. Place the following code in the ThisWorkbook module (Alt+F11, d-click on ThisWorkbook in left hand window then paste in right hand window)


Private Sub Workbook_Open()
Dim Sh As Worksheet

For Each Sh In ThisWorkbook.Sheets
If Sh.Visible = True Then
If UCase(Left(Sh.Name, 3)) = UCase(Format(Now, "MMM")) _
Then Sh.Activate: Exit Sub
End If
Next Sh
End Sub