Using Current Date to Move to a Specific Sheet

TripleT

New Member
Joined
Jan 14, 2004
Messages
16
Hi

I would like to create a macro using Auto_Open. What I would like it to do is look at the current date, then move to a specific sheet. For example if today is the 15th of January, I'd like it to move to the January sheet; if it's the 15th of February, I'd like it to move to February's sheet.

Can someone help me out, or tell me where I can start.

Thanks.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
Welcome to the Board!

Something like this might get you started:
Code:
Private Sub Workbook_Open()
    If Date >= #1/1/2004# And Date <= #1/31/2004# Then Application.Goto Reference:="January"
    If Date >= #2/1/2004# And Date <= #2/28/2004# Then Application.Goto Reference:="February"
    ' And so on...
End Sub
Hope that helps,

Smitty
 

Barrie Davidson

MrExcel MVP
Joined
Feb 10, 2002
Messages
2,330
Or:

Code:
Private Sub Workbook_Open()
    Sheets(Format(Now, "mmmm")).Activate
End Sub

Regards,
 

TripleT

New Member
Joined
Jan 14, 2004
Messages
16
Thanks for your help. Both solutions worked perfect, and will be suitable for a variety of spreadsheets I'm working on.

Thanks again.
:biggrin:
 

Watch MrExcel Video

Forum statistics

Threads
1,130,448
Messages
5,642,218
Members
417,262
Latest member
andrewd1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top