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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
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,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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