I have read now numerous posts on how to do this but i keep getting a mismatch or an out of range error.
My workbook has 13 sheets all named for each month. I have sheet13 named Sensitive routing.
if i go to VBA all my sheets in the Project window show up as "Sheet1(JAN11)" and so on ...in the properties of the sheet i want to hide, 13, it shows (name) "Sheet 13" and on down is Name "Sensitive Routing" (obviously no quotes).
Ok now my code is all botched up, because, well i stink at this and am trying to patch numerous other codes togehter.. what i have is:
My end state is a button the user is presented on the first page, for Command View - which will run the macro to unhide the "Sensitive Routing" tab. But if i can just get a little hellp in actually making the macro hide/unhide the sheet it would be great. Also, im seem to be a little slow today on where i need "" and where i dont - i think i have it right, now, but i could be way, way off.
Also im stuck using Excel 2007
Thanks in advance, and i will continue to scour the web for better examples ...
My workbook has 13 sheets all named for each month. I have sheet13 named Sensitive routing.
if i go to VBA all my sheets in the Project window show up as "Sheet1(JAN11)" and so on ...in the properties of the sheet i want to hide, 13, it shows (name) "Sheet 13" and on down is Name "Sensitive Routing" (obviously no quotes).
Ok now my code is all botched up, because, well i stink at this and am trying to patch numerous other codes togehter.. what i have is:
Code:
Option Explicit
Dim Sheet13 As Worksheet
Sub ShowSheet()
Const mypass = 1100
On Error GoTo errhandler
passtry = InputBox("Please Enter A Password To Unhide Sheet")
If passtry <> mypass Or passtry = vbNullString Then Exit Sub
ActiveWorkbook.Sheets(Sheet13).Visible = xlSheetVisible
errhandler:
End Sub
Sub HideSheet()
ActiveWorkbook.Sheets(Sheet13).Visible = xlSheetVeryHidden
End Sub
My end state is a button the user is presented on the first page, for Command View - which will run the macro to unhide the "Sensitive Routing" tab. But if i can just get a little hellp in actually making the macro hide/unhide the sheet it would be great. Also, im seem to be a little slow today on where i need "" and where i dont - i think i have it right, now, but i could be way, way off.
Also im stuck using Excel 2007
Thanks in advance, and i will continue to scour the web for better examples ...