I have this code assigned to a command button (on sheet 5). My goal is when the command button is clicked, sheet 4 will be shown and other sheets will be hidden. But unfortunately when i run the code, it shows error:
Run time error 1004: application-defined or object-defined error
Any idea how to solve this?
Sub Sample()
Sheet1.Visible = False
Sheet2.Visible = False
Sheet3.Visible = False
Sheet4.Visible = True
Sheet5.Visible = False
Sheet6.Visible = False
Sheet7.Visible = False
Sheet8.Visible = False
Sheet4.Activate
End Sub
Run time error 1004: application-defined or object-defined error
Any idea how to solve this?
Sub Sample()
Sheet1.Visible = False
Sheet2.Visible = False
Sheet3.Visible = False
Sheet4.Visible = True
Sheet5.Visible = False
Sheet6.Visible = False
Sheet7.Visible = False
Sheet8.Visible = False
Sheet4.Activate
End Sub