Open a workbook with Multiply Worksheets to today's date.

Tnarg100

New Member
Joined
Jul 18, 2018
Messages
5
Hello,

I am trying to find a vba code that will open my workbook to today's date. I have found many that work with just the one sheet as people only want to highlight the cell. My workbook is a rota, so this means that each month is a separate sheet and is continually being added to as the months roll by.
What I am trying to find is that when you open the workbook for the first time that day it opens the worksheet that has today's date in it. So today being 18th July 2018 then worksheet July 2018 will be opened.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi welcome to forum.

Assuming your tab names are named in way you have shown then try following

Place following code in the Thisworkbook Code page.
Code:
Private Sub Workbook_Open()
    Worksheets(MonthName(Month(Date), False) & " " & Year(Date)).Activate
End Sub

when your workbook is opened, code should activate tab with current month / year name.

note: code will error if tab name does not exist.

Dave
 
Last edited:
Upvote 0
Thank you very much Dave,

That works perfectly. Would you have any advice as to any training books that a beginner (been bitten by the vba bug) should get? I have the Excel VBA programming for dummies which I am I going through at the moment.
 
Upvote 0
Thank you very much Dave,

That works perfectly. Would you have any advice as to any training books that a beginner (been bitten by the vba bug) should get? I have the Excel VBA programming for dummies which I am I going through at the moment.


Hi,
glad solution worked ok for you.

Your book is a good start but worth visiting the many sites that offer advice & guidance in Excel & VBA

Like:
http://www.contextures.com/

http://www.cpearson.com/Excel/MainPage.aspx

are just two of the better known here that offer free guidance & example files you can download but there are others.

Dave
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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
Back
Top