Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Hiding and Showing Sheets using Macro

Hi Does any have any ideas on how to create a macro for this or if this is
possible?

- I want to have 1 workbook with about 13 spreadsheets in it.
- When I open the workbook I only want to see "sheet 1" (with the other 12
spreadsheets hidden)
- On sheet 1 i want to have 3 buttons, 1. Commodities 2. Forex 3. Options
- When I click on the 'Commodities' button, I want spreadsheets 2,3,4 & 5 to
show/be unhidden
- I also want there to be a button on spreadsheet 2,3,4,&5 to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 2,3,4 & 5 hidden again (like when i first open the workbook)
- When i click on the 'Forex' button, I want spreadsheet 6,7,8 & 9 to be
shown/unhidden
- I also want there to be a button on spreadsheet 6,7,8 & 9 to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 6,7,8 & 9 hidden again (like when i first open the workbook)
- When i click on the 'Options' button, I want spreadsheet 10,11 & 12 to be
shown/unhidden
- I also want there to be a button on spreadsheet 10,11 & 12to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 10,11 & 12hidden again (like when i first open the workbook)

I'm not sure if what i want to do is even possible and would really
appreciate any help on how to do this or on a better way to do this.

Many thanks in advance!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Hiding and Showing Sheets using Macro

hi,
very possible. i didn't write in all so you will have to do some creating on
you own, i am just showing you have to get started.
hide all sheets except 1 when you save and close the file. that way only one
sheet will be showing at open.
drop a command button on the sheet and put this code in it. it will unhide
the first five sheets and activate(select) sheet2. change if you want. this
same code can be use for your other 2 buttons except different sheet names.
Private Sub CommandButton1_Click()
Sheets("Sheet2").Visible = True
Sheets("Sheet3").Visible = True
Sheets("Sheet4").Visible = True
Sheets("Sheet5").Visible = True
Sheets("Sheet2").Activate
End Sub

code to return to sheet1 and rehide sheets 2-5... this code can be use for
all the other return/rehide buttons except... again... different sheet names.
Private Sub CommandButton2_Click()
Sheets("sheet1").Activate
Sheets("Sheet2").Visible = False
Sheets("Sheet3").Visible = False
Sheets("Sheet4").Visible = False
Sheets("Sheet5").Visible = False
End Sub

hope this helps.

Regards
FSt1

"engbe" wrote:

Hi Does any have any ideas on how to create a macro for this or if this is
possible?

- I want to have 1 workbook with about 13 spreadsheets in it.
- When I open the workbook I only want to see "sheet 1" (with the other 12
spreadsheets hidden)
- On sheet 1 i want to have 3 buttons, 1. Commodities 2. Forex 3. Options
- When I click on the 'Commodities' button, I want spreadsheets 2,3,4 & 5 to
show/be unhidden
- I also want there to be a button on spreadsheet 2,3,4,&5 to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 2,3,4 & 5 hidden again (like when i first open the workbook)
- When i click on the 'Forex' button, I want spreadsheet 6,7,8 & 9 to be
shown/unhidden
- I also want there to be a button on spreadsheet 6,7,8 & 9 to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 6,7,8 & 9 hidden again (like when i first open the workbook)
- When i click on the 'Options' button, I want spreadsheet 10,11 & 12 to be
shown/unhidden
- I also want there to be a button on spreadsheet 10,11 & 12to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 10,11 & 12hidden again (like when i first open the workbook)

I'm not sure if what i want to do is even possible and would really
appreciate any help on how to do this or on a better way to do this.

Many thanks in advance!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Hiding and Showing Sheets using Macro

I took much the same, straightforward route that FSt1 took. I used Command
Buttons from the "Forms" toolbar rather than from the Controls toolbar, and
I've put some code in both the Workbook_Open() event and the 'main menu'
(3-button) sheet's Worksheet_Activate() code to save some lines of code
elsewhere. You can examine the workbook itself by downloading it from he
http://www.jlathamsite.com/uploads/for_engbe.xls



"FSt1" wrote:

hi,
very possible. i didn't write in all so you will have to do some creating on
you own, i am just showing you have to get started.
hide all sheets except 1 when you save and close the file. that way only one
sheet will be showing at open.
drop a command button on the sheet and put this code in it. it will unhide
the first five sheets and activate(select) sheet2. change if you want. this
same code can be use for your other 2 buttons except different sheet names.
Private Sub CommandButton1_Click()
Sheets("Sheet2").Visible = True
Sheets("Sheet3").Visible = True
Sheets("Sheet4").Visible = True
Sheets("Sheet5").Visible = True
Sheets("Sheet2").Activate
End Sub

code to return to sheet1 and rehide sheets 2-5... this code can be use for
all the other return/rehide buttons except... again... different sheet names.
Private Sub CommandButton2_Click()
Sheets("sheet1").Activate
Sheets("Sheet2").Visible = False
Sheets("Sheet3").Visible = False
Sheets("Sheet4").Visible = False
Sheets("Sheet5").Visible = False
End Sub

hope this helps.

Regards
FSt1

"engbe" wrote:

Hi Does any have any ideas on how to create a macro for this or if this is
possible?

- I want to have 1 workbook with about 13 spreadsheets in it.
- When I open the workbook I only want to see "sheet 1" (with the other 12
spreadsheets hidden)
- On sheet 1 i want to have 3 buttons, 1. Commodities 2. Forex 3. Options
- When I click on the 'Commodities' button, I want spreadsheets 2,3,4 & 5 to
show/be unhidden
- I also want there to be a button on spreadsheet 2,3,4,&5 to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 2,3,4 & 5 hidden again (like when i first open the workbook)
- When i click on the 'Forex' button, I want spreadsheet 6,7,8 & 9 to be
shown/unhidden
- I also want there to be a button on spreadsheet 6,7,8 & 9 to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 6,7,8 & 9 hidden again (like when i first open the workbook)
- When i click on the 'Options' button, I want spreadsheet 10,11 & 12 to be
shown/unhidden
- I also want there to be a button on spreadsheet 10,11 & 12to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 10,11 & 12hidden again (like when i first open the workbook)

I'm not sure if what i want to do is even possible and would really
appreciate any help on how to do this or on a better way to do this.

Many thanks in advance!

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Hiding and Showing Sheets using Macro

THANK YOU THANK YOU THANK YOU to the both of you!!! Both of you don't know
how much i appreciate this...and an extra THANK YOU to JLatham for taking the
time to actually create it in a work book and answering yet another one of my
questions : )

"JLatham" wrote:

I took much the same, straightforward route that FSt1 took. I used Command
Buttons from the "Forms" toolbar rather than from the Controls toolbar, and
I've put some code in both the Workbook_Open() event and the 'main menu'
(3-button) sheet's Worksheet_Activate() code to save some lines of code
elsewhere. You can examine the workbook itself by downloading it from he
http://www.jlathamsite.com/uploads/for_engbe.xls



"FSt1" wrote:

hi,
very possible. i didn't write in all so you will have to do some creating on
you own, i am just showing you have to get started.
hide all sheets except 1 when you save and close the file. that way only one
sheet will be showing at open.
drop a command button on the sheet and put this code in it. it will unhide
the first five sheets and activate(select) sheet2. change if you want. this
same code can be use for your other 2 buttons except different sheet names.
Private Sub CommandButton1_Click()
Sheets("Sheet2").Visible = True
Sheets("Sheet3").Visible = True
Sheets("Sheet4").Visible = True
Sheets("Sheet5").Visible = True
Sheets("Sheet2").Activate
End Sub

code to return to sheet1 and rehide sheets 2-5... this code can be use for
all the other return/rehide buttons except... again... different sheet names.
Private Sub CommandButton2_Click()
Sheets("sheet1").Activate
Sheets("Sheet2").Visible = False
Sheets("Sheet3").Visible = False
Sheets("Sheet4").Visible = False
Sheets("Sheet5").Visible = False
End Sub

hope this helps.

Regards
FSt1

"engbe" wrote:

Hi Does any have any ideas on how to create a macro for this or if this is
possible?

- I want to have 1 workbook with about 13 spreadsheets in it.
- When I open the workbook I only want to see "sheet 1" (with the other 12
spreadsheets hidden)
- On sheet 1 i want to have 3 buttons, 1. Commodities 2. Forex 3. Options
- When I click on the 'Commodities' button, I want spreadsheets 2,3,4 & 5 to
show/be unhidden
- I also want there to be a button on spreadsheet 2,3,4,&5 to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 2,3,4 & 5 hidden again (like when i first open the workbook)
- When i click on the 'Forex' button, I want spreadsheet 6,7,8 & 9 to be
shown/unhidden
- I also want there to be a button on spreadsheet 6,7,8 & 9 to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 6,7,8 & 9 hidden again (like when i first open the workbook)
- When i click on the 'Options' button, I want spreadsheet 10,11 & 12 to be
shown/unhidden
- I also want there to be a button on spreadsheet 10,11 & 12to say 'Back to
Spreadsheet 1' and when clicked will navigate back to spreadsheet 1 and
spreadsheets 10,11 & 12hidden again (like when i first open the workbook)

I'm not sure if what i want to do is even possible and would really
appreciate any help on how to do this or on a better way to do this.

Many thanks in advance!

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
Hiding/Showing Rows on Cell H2 Change Rob Excel Discussion (Misc queries) 9 December 14th 08 01:44 AM
hiding or showing rows based on a cell value jordanpcpre Excel Discussion (Misc queries) 6 April 24th 08 04:14 PM
Showing and hiding series in charts Matt H Excel Discussion (Misc queries) 2 February 28th 08 10:14 PM
Conditionally Hiding or Showing the cell content Tim Excel Discussion (Misc queries) 4 August 26th 07 07:52 AM
hiding and showing graphs chrisrowe_cr Excel Worksheet Functions 0 September 2nd 05 11:22 AM


All times are GMT +1. The time now is 03:26 PM.

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

About Us

"It's about Microsoft Excel"