I have a userform with a number of tabs that relate to specific worksheets. I’m trying to activate a specific tab depending on what the active worksheet is when the userform is initialized. Can someone help me out here.
Thanks.
Private Sub UserForm_Initialize()
If ActiveSheet.Name = "Test1" Then
MultiPageSheets.SelectedItem.Index = 0
ElseIf ActiveSheet.Name = "Test2" Then
MultiPageSheets.SelectedItem.Index = 1
ElseIf ActiveSheet.Name = "Test3" Then
MultiPageSheets.SelectedItem.Index = 2
ElseIf ActiveSheet.Name = "Test4" Then
MultiPageSheets.SelectedItem.Index = 3
End If
End Sub
Try:
Private Sub UserForm_Initialize()
If ActiveSheet.Name = "Test1" Then
MultiPageSheets.Value = 0
ElseIf ActiveSheet.Name = "Test2" Then
MultiPageSheets.Value = 1
ElseIf ActiveSheet.Name = "Test3" Then
MultiPageSheets.Value = 2
ElseIf ActiveSheet.Name = "Test4" Then
MultiPageSheets.Value = 3
End If
End Sub