I have button1 assigned ot the following macro on the 'headerpage'
worksheet of my workbook. When the button is clicked it makes the
'Instruction' worksheet visible and active.
Sub hide_sheet()
'
Static fOn As Boolean
fOn = Not fOn
Sheets("Instructions").Visible = True = fOn
Sheets("Instructions").Select
End Sub
On the 'Instruction' worksheet I have button2 with the following code.
THis takes the user back to the 'headerpage' worksheet and rehides the
'instruction' worksheet.
Sub hide_instruction2()
'
Static fOff As Boolean
Sheets("HeaderPage").Select
fOn = Not fOn
Sheets("Instructions").Visible = False = fOn
End Sub
THE ISSUE
When youy click on button1 for the first time it works fine, then click
on button to and it indeed does take the user back to the 'headerpage'
worksheet and rehides the 'instruction' worksheet.
However, if I click on button1 again it gives me a 'runtime error 1004'
and highlights the line 'Sheets("Instructions").Select' in the Sub
hide_sheet() macro assigned to button 1.
Why? and how do I get this to work so no matter howmany times the user
wants to switch back and forth between the two pages it will allow them
to?
Thanks
Dan
--
retseort
------------------------------------------------------------------------
retseort's Profile:
http://www.excelforum.com/member.php...o&userid=24690
View this thread:
http://www.excelforum.com/showthread...hreadid=483613