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
 

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

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
75,732
Office Version
365
Platform
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"]
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,009
Messages
5,508,758
Members
408,692
Latest member
OptimalKR

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top