I am not very experienced with VBA and hoping the community can help me with a challenge I am facing. I have an excel workbook with about 20 tabs. I am trying to accomplish the following:
Private Sub Workbook_Open()
Sheet1.Visible = xlSheetVisible
Sheet2.Visible = xlSheetHidden
Sheet3.Visible = xlSheetHidden
End Sub
Private Sub CommandButton1_Click()
ThisWorkBook.Worksheets ("test_tab").Visible = xlSheetVisible
End Sub
I've done a lot of research, watched tutorials but none seem to have this exact use case. Hoping someone can help me out.
You need to add a line to activate the worksheet.
Private Sub CommandButton1_Click()
ThisWorkBook.Worksheets ("test_tab").Visible = xlSheetVisible
ThisWorkBook.Worksheets ("test_tab").Activate
End Sub