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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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
 
Upvote 0
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:
Upvote 0
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.
 
Upvote 0
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"]
 
Upvote 0

Forum statistics

Threads
1,214,601
Messages
6,120,467
Members
448,965
Latest member
grijken

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
Back
Top