Reg Macros and Hidden sheets

regeen_sonu

New Member
Joined
Jul 23, 2010
Messages
4
ive got a macro which works with hidden sheets within the workbook - when i hide the sheets the macro gives errors and will not run. when i unhide the sheets everything runs fine!
I have got a workbook which has 8 sheets. Index, Contact Details, SLA, WO Review, SLAM Reports, SA Reports, CCR Reports, Samples. The index sheet has Command buttons which direct them to the respective other sheets. What i want is the excel should aways open with the index sheet, and all the other sheets shud not be visible. Is it Posssible. Please find the code in the index sheet
Private Sub CommandButton1_Click()
'
' Contact Macro
'
'
Sheets("Contact Details").Select
End Sub
Private Sub CommandButton2_Click()
'
' Contact Macro
'
'
Sheets("SLA").Select
End Sub
Private Sub CommandButton3_Click()
'
' Contact Macro
'
'
Sheets("SLAM Reports").Select
End Sub
Private Sub CommandButton4_Click()
'
' Contact Macro
'
'
Sheets("SAM Reports").Select
End Sub
Private Sub CommandButton5_Click()
'
' Contact Macro
'
'
Sheets("CCR Reports").Select
End Sub
Private Sub CommandButton7_Click()
'
' Contact Macro
'
'
Sheets("WO Review").Select
End Sub
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Akashwani

Well-known Member
Joined
Mar 14, 2009
Messages
2,911
Hi,

I don't understand VBA but I think that you may need to put this....

Sheets("Contact Details").Visible = True

before

Sheets("Contact Details").Select

repeat as required.

Good luck

Ak
 

regeen_sonu

New Member
Joined
Jul 23, 2010
Messages
4
Hi,

Thankyou very much.
Now i have put the code accordingly and i went ahead and hide the sheets, now whenever i am clicking on the Index sheet whichever sheets get opened remain there. Like For eg. once i click on " Contact Details" i have a Button on the "Contact Details" which when clicked takes me back to the "INDEX" Sheet but the "contact Details" still remains there. It should again get hide. Please Help

One more issue : As i told you i have 8 Sheets, Index, Contact Details, SLA, WO Review, SLAM Reports, SA Reports, CCR Reports, Samples.
Now Index is the mian page,
Contact details, SLA : This sheets dont have any other buttons except a Button to go back to " Index" Sheet
WO Review, SLAM Reports, SAM Reports, CCR Reports: Now this sheets have a button To go back to "Index" sheet plus it also has buttons which will move me automatically to the "samples" sheet where i have inserted another excel file please help
 
Last edited:

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,298
Office Version
  1. 365
Platform
  1. Windows
regeen

What in words do you actually want to do?

Have all the worksheets except the Index hidden and have a button for each on that worksheet?

When pressed the button unhides and takes you to the relevant worksheet.

Then on the other worksheets have a button that hides the worksheet and returns to the Index sheet.
 

regeen_sonu

New Member
Joined
Jul 23, 2010
Messages
4
regeen

What in words do you actually want to do?

Have all the worksheets except the Index hidden and have a button for each on that worksheet?

When pressed the button unhides and takes you to the relevant worksheet.

Then on the other worksheets have a button that hides the worksheet and returns to the Index sheet.

[Yes, but as i said the last the last four sheets have buttons which take me to a Sheet named " SAMPLES"]
 

Watch MrExcel Video

Forum statistics

Threads
1,133,157
Messages
5,657,159
Members
418,363
Latest member
Debating_Earth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top