Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to put a command button on m

Status
Not open for further replies.

bnageshrao

Programmer
Mar 17, 2001
83
US
I want to put a command button on my first sheet and when i click on it I want it to show me second sheet by hiding the first sheet and vice versa. I used the statement Activesheet.hide and the show command for the other and it came out with an error.
 
Code for Command Button on Sheet1
Code:
Private Sub CommandButton1_Click()
    Sheets("Sheet2").Visible = xlSheetVisible
    Sheets("Sheet2").Select
    Sheets("Sheet1").Visible = xlSheetHidden
End Sub
Code for Command Button on Sheet2
Code:
Private Sub CommandButton1_Click()
    Sheets("Sheet1").Visible = xlSheetVisible
    Sheets("Sheet1").Select
    Sheets("Sheet2").Visible = xlSheetHidden
End Sub
 

bnageshrao
:

Of course it worked. dsi knows this stuff very well! s-)

LoNeRaVeR
 
I have learned some stuff from you as well! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top