I have an Excel file that contains a lot of different Sheets. I took the work on me to clean up the mess and made a nice looking “Main Menu” where users can click on different buttons that then will hide or unhide the respective sheets.
So far it is working great and without any major issues, except one. Me and my 2 Co-Worker’s are mainly on the same Sheet and have to switch not very often. But when either one is switching to the Main Menu, the same happens for the other users as well, so they get “kicked” to the Main Menu, and they have to go back to the last used sheet.
I can’t really figure out how to add an “If user x is clicked then do something, else nothing” function in, or why this only happens when either one is clicking on the “Main Menu”.
For the Main Menu, the event triggers with the Worksheet_Activate event.
Maybe someone has an idea on how to Prevent the Sheet switching to happen for all users, or maybe an If Statement
The code is as Follows (shortened):
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Sheets("Januar").Visible = False
Sheets("Februar").Visible = False
Sheets("März").Visible = False
Sheets("April").Visible = False
Sheets("Mai").Visible = False
Sheets("Juni").Visible = False
Sheets("Juli").Visible = False
Sheets("August").Visible = False
Sheets("September").Visible = False
Sheets("Oktober").Visible = False
Sheets("November").Visible = False
Sheets("Dezember").Visible = False
.
.
.
'The other Sheets also get's hidden
If Application.WindowState = xlMaximized Then
Tabelle20.Range("A1").Select
Else
Tabelle20.Range("L17").Select
End If
'The If WindowState just makes sure the Main Menu is in the Middel of the Screen when it is Maximized or SplitScreen
Call BenutzerModus
'BenutzerModus just hides the Formularbar, Toolbar, and makes it Fullscreen
Application.ScreenUpdating = True
End Sub
Tried it with the ‘Application.Username’ but I’m not able to get it working properly
Pascal Breuil is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.