Excel 2010, shared workbook does not open to last tab worked in.

haydenmike

New Member
Joined
Nov 21, 2018
Messages
3
We have a schedule that about 7 people access. When a user opens the workbook it keeps defaulting to a tab that was the work schedule from several weeks earlier. I would like it to default to opening in the current weekly schedule. Or just open in the last used / saved tab?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try this, it will need to be entered in "ThisWorkbook" in the VBA editor.

Code:
Private Sub Workbook_Open()


weekstartmonth = WorksheetFunction.Text(Now, "Mmm")
weekstartday = Format(Now - Weekday(Now, vbUseSystem) + 1, "DD")
weekendmonth = WorksheetFunction.Text(Now - Weekday(Now, 2) + 8, "Mmm")
weekendday = Format(Now - Weekday(Now, vbUseSystem) + 7, "DD")
myyear = Year(Now)


shtstr = weekstartmonth & " " & weekstartday & " to " & weekendmonth & " " & weekendday & "," & myyear


Sheets(shtstr).Select


End Sub
 
Upvote 0
I will try this on Monday. Thank you



Try this, it will need to be entered in "ThisWorkbook" in the VBA editor.

Code:
Private Sub Workbook_Open()


weekstartmonth = WorksheetFunction.Text(Now, "Mmm")
weekstartday = Format(Now - Weekday(Now, vbUseSystem) + 1, "DD")
weekendmonth = WorksheetFunction.Text(Now - Weekday(Now, 2) + 8, "Mmm")
weekendday = Format(Now - Weekday(Now, vbUseSystem) + 7, "DD")
myyear = Year(Now)


shtstr = weekstartmonth & " " & weekstartday & " to " & weekendmonth & " " & weekendday & "," & myyear


Sheets(shtstr).Select


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,869
Messages
6,127,416
Members
449,382
Latest member
DonnaRisso

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