Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default create button that can hide/unhide sheets and hyperlink...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default create button that can hide/unhide sheets and hyperlink...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default create button that can hide/unhide sheets and hyperlink...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default create button that can hide/unhide sheets and hyperlink...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default create button that can hide/unhide sheets and hyperlink...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default create button that can hide/unhide sheets and hyperlink...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default create button that can hide/unhide sheets and hyperlink...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default create button that can hide/unhide sheets and hyperlink...

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
hide or unhide rows with button Bea Excel Discussion (Misc queries) 15 September 19th 07 07:03 PM
Code for button to hide/unhide rows Chris Excel Worksheet Functions 5 March 5th 07 06:15 AM
Command Button to Hide/Unhide Rows Bea Excel Discussion (Misc queries) 4 March 16th 06 03:21 PM
Hide/Unhide sheets ali Excel Programming 1 January 30th 04 10:06 PM
Hide/Unhide sheets [email protected] Excel Programming 4 January 5th 04 03:32 AM


All times are GMT +1. The time now is 11:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"