Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I'm trying to figure out two things;
create a button that can hide/unhide sheets create a button that can takes the user to another place in the work book (even if that sheet is hidden) - maybe this is a hyperlink of sorts? (I know how to create the buttons, just need help big time(!) with the code) Thanks! Helen |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Helen,
Put the following code behind your button. With Worksheets("Sheet1") .Visible = Not .Visible End With It will toggle Sheet1 between hidden and visible. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Helen" wrote in message ... Hi, I'm trying to figure out two things; create a button that can hide/unhide sheets create a button that can takes the user to another place in the work book (even if that sheet is hidden) - maybe this is a hyperlink of sorts? (I know how to create the buttons, just need help big time(!) with the code) Thanks! Helen |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
And if I want to do more than one sheet, do I do some kind of array?
Thanks, Helen "Chip Pearson" wrote in message ... Helen, Put the following code behind your button. With Worksheets("Sheet1") .Visible = Not .Visible End With It will toggle Sheet1 between hidden and visible. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Helen" wrote in message ... Hi, I'm trying to figure out two things; create a button that can hide/unhide sheets create a button that can takes the user to another place in the work book (even if that sheet is hidden) - maybe this is a hyperlink of sorts? (I know how to create the buttons, just need help big time(!) with the code) Thanks! Helen |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Helen,
create a button that can hide/unhide sheets Try: '============ Private Sub CommandButton1_Click() Dim SH As Worksheet Set SH = ActiveWorkbook.Sheets("Sheet3") '<<=== CHANGE SH.Visible = Not SH.Visible End Sub '<<============ create a button that can takes the user to another place in the work book (even if that sheet is hidden) Try: '============ Sub Tester2() Dim SH As Worksheet Dim rng As Range Set SH = ActiveWorkbook.Sheets("Sheet2") '<<=== CHANGE Set rng = SH.Range("A10") '<<=== CHANGE SH.Visible = True Application.Goto rng End Sub '<<============ --- Regards, Norman "Helen" wrote in message ... Hi, I'm trying to figure out two things; create a button that can hide/unhide sheets create a button that can takes the user to another place in the work book (even if that sheet is hidden) - maybe this is a hyperlink of sorts? (I know how to create the buttons, just need help big time(!) with the code) Thanks! Helen |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Norman,
You're helping me a lot today!! If I want to unhide/hide more than one sheet, how do I go about doing that? Some kind of array as well...? Thanks, Helen "Norman Jones" wrote in message ... Hi Helen, create a button that can hide/unhide sheets Try: '============ Private Sub CommandButton1_Click() Dim SH As Worksheet Set SH = ActiveWorkbook.Sheets("Sheet3") '<<=== CHANGE SH.Visible = Not SH.Visible End Sub '<<============ create a button that can takes the user to another place in the work book (even if that sheet is hidden) Try: '============ Sub Tester2() Dim SH As Worksheet Dim rng As Range Set SH = ActiveWorkbook.Sheets("Sheet2") '<<=== CHANGE Set rng = SH.Range("A10") '<<=== CHANGE SH.Visible = True Application.Goto rng End Sub '<<============ --- Regards, Norman "Helen" wrote in message ... Hi, I'm trying to figure out two things; create a button that can hide/unhide sheets create a button that can takes the user to another place in the work book (even if that sheet is hidden) - maybe this is a hyperlink of sorts? (I know how to create the buttons, just need help big time(!) with the code) Thanks! Helen |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Helen,
If I want to unhide/hide more than one sheet, how do I go about doing that? Some kind of array as well...? Try: '============== Private Sub CommandButton1_Click() Dim SH As Worksheet For Each SH In Sheets(Array("Sheet2", "Sheet3")) '<<=== CHANGE SH.Visible = Not SH.Visible Next SH End Sub '<<============== --- Regards, Norman "Helen" wrote in message ... Hi Norman, You're helping me a lot today!! If I want to unhide/hide more than one sheet, how do I go about doing that? Some kind of array as well...? Thanks, Helen "Norman Jones" wrote in message ... Hi Helen, create a button that can hide/unhide sheets Try: '============ Private Sub CommandButton1_Click() Dim SH As Worksheet Set SH = ActiveWorkbook.Sheets("Sheet3") '<<=== CHANGE SH.Visible = Not SH.Visible End Sub '<<============ create a button that can takes the user to another place in the work book (even if that sheet is hidden) Try: '============ Sub Tester2() Dim SH As Worksheet Dim rng As Range Set SH = ActiveWorkbook.Sheets("Sheet2") '<<=== CHANGE Set rng = SH.Range("A10") '<<=== CHANGE SH.Visible = True Application.Goto rng End Sub '<<============ --- Regards, Norman "Helen" wrote in message ... Hi, I'm trying to figure out two things; create a button that can hide/unhide sheets create a button that can takes the user to another place in the work book (even if that sheet is hidden) - maybe this is a hyperlink of sorts? (I know how to create the buttons, just need help big time(!) with the code) Thanks! Helen |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks! Works great.
I noticed if my sheets are hidden then my preview button will not work. I'm assuming I should add some code that checks if the sheets are hidden, and if they are, then unhide them before performing the Preview command... Obviulsy I have NO idea how to do that either! Thanks! Helen "Norman Jones" wrote in message ... Hi Helen, If I want to unhide/hide more than one sheet, how do I go about doing that? Some kind of array as well...? Try: '============== Private Sub CommandButton1_Click() Dim SH As Worksheet For Each SH In Sheets(Array("Sheet2", "Sheet3")) '<<=== CHANGE SH.Visible = Not SH.Visible Next SH End Sub '<<============== --- Regards, Norman "Helen" wrote in message ... Hi Norman, You're helping me a lot today!! If I want to unhide/hide more than one sheet, how do I go about doing that? Some kind of array as well...? Thanks, Helen "Norman Jones" wrote in message ... Hi Helen, create a button that can hide/unhide sheets Try: '============ Private Sub CommandButton1_Click() Dim SH As Worksheet Set SH = ActiveWorkbook.Sheets("Sheet3") '<<=== CHANGE SH.Visible = Not SH.Visible End Sub '<<============ create a button that can takes the user to another place in the work book (even if that sheet is hidden) Try: '============ Sub Tester2() Dim SH As Worksheet Dim rng As Range Set SH = ActiveWorkbook.Sheets("Sheet2") '<<=== CHANGE Set rng = SH.Range("A10") '<<=== CHANGE SH.Visible = True Application.Goto rng End Sub '<<============ --- Regards, Norman "Helen" wrote in message ... Hi, I'm trying to figure out two things; create a button that can hide/unhide sheets create a button that can takes the user to another place in the work book (even if that sheet is hidden) - maybe this is a hyperlink of sorts? (I know how to create the buttons, just need help big time(!) with the code) Thanks! Helen |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Helen,
Try: '============== Private Sub CommandButton2_Click() Dim SH As Worksheet Dim arr As Variant arr = Array("Sheet2", "Sheet3") '<<=== CHANGE For Each SH In Sheets(arr) SH.Visible = True Next Sheets(arr).PrintPreview End Sub '<<============== --- Regards, Norman "Helen" wrote in message ... Thanks! Works great. I noticed if my sheets are hidden then my preview button will not work. I'm assuming I should add some code that checks if the sheets are hidden, and if they are, then unhide them before performing the Preview command... Obviulsy I have NO idea how to do that either! Thanks! Helen "Norman Jones" wrote in message ... Hi Helen, If I want to unhide/hide more than one sheet, how do I go about doing that? Some kind of array as well...? Try: '============== Private Sub CommandButton1_Click() Dim SH As Worksheet For Each SH In Sheets(Array("Sheet2", "Sheet3")) '<<=== CHANGE SH.Visible = Not SH.Visible Next SH End Sub '<<============== --- Regards, Norman "Helen" wrote in message ... Hi Norman, You're helping me a lot today!! If I want to unhide/hide more than one sheet, how do I go about doing that? Some kind of array as well...? Thanks, Helen "Norman Jones" wrote in message ... Hi Helen, create a button that can hide/unhide sheets Try: '============ Private Sub CommandButton1_Click() Dim SH As Worksheet Set SH = ActiveWorkbook.Sheets("Sheet3") '<<=== CHANGE SH.Visible = Not SH.Visible End Sub '<<============ create a button that can takes the user to another place in the work book (even if that sheet is hidden) Try: '============ Sub Tester2() Dim SH As Worksheet Dim rng As Range Set SH = ActiveWorkbook.Sheets("Sheet2") '<<=== CHANGE Set rng = SH.Range("A10") '<<=== CHANGE SH.Visible = True Application.Goto rng End Sub '<<============ --- Regards, Norman "Helen" wrote in message ... Hi, I'm trying to figure out two things; create a button that can hide/unhide sheets create a button that can takes the user to another place in the work book (even if that sheet is hidden) - maybe this is a hyperlink of sorts? (I know how to create the buttons, just need help big time(!) with the code) Thanks! Helen |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
hide or unhide rows with button | Excel Discussion (Misc queries) | |||
Code for button to hide/unhide rows | Excel Worksheet Functions | |||
Command Button to Hide/Unhide Rows | Excel Discussion (Misc queries) | |||
Hide/Unhide sheets | Excel Programming | |||
Hide/Unhide sheets | Excel Programming |