Open Event Code Bug
Tim
The first problem is that your references to the range containing the sheet
visible values need to change to explicitly reference the cell, use the
following....
Sheets("Enable Macro").Visible = Sheets("Data Input").Range("C3").Value
Secondly - what are the values you are using on the Data Input sheet to
control the visibility?
The valid value (if you use the above method) are -1 for visible, 0 Hidden
and 2 Very Hidden
Hope this helps
Cheers
Nigel
"Tim" wrote in message
om...
Hello,
I have a problem with the code below.
I am trying to 'very hide' all sheets except the "Enable Macro"
warning sheet upon closing my workbook.
When opening the workbook and if the user disabled macros I want them
to see only the warning sheet.
If the user enabled macros upon opening I want them the see all of the
sheets except:
Enable Macro Sheet
Other sheets I set as very hidden (see code upon open)
The sheets i set as very hidden will depend on the cell value
contained on the sheet "Data Input"
This data input sheet returns the Value TRUE or FALSE (ranges C3:C21)
for the workbook sheets.
The problem I face is that my code is wrong somewhere, I can;t even
close my workbook without a code area.
Any assistance you guru's could offer me would be greatly appreciated.
Thanks
Tim
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Enable Macro").Visible = True
Sheets("Cover").Visible = xlSheetVeryHidden
Sheets("Key Assumptions").Visible = xlSheetVeryHidden
Sheets("Notes").Visible = xlSheetVeryHidden
Sheets("FF&E Master").Visible = xlSheetVeryHidden
Sheets("Area Analisys").Visible = xlSheetVeryHidden
Sheets("FF&E Price Input").Visible = xlSheetVeryHidden
Sheets("Construction Costs").Visible = xlSheetVeryHidden
Sheets("Depreciation").Visible = xlSheetVeryHidden
Sheets("OE & Uniform").Visible = xlSheetVeryHidden
Sheets("Payroll").Visible = xlSheetVeryHidden
Sheets("P&L year 1").Visible = xlSheetVeryHidden
Sheets("P&L year 1-5").Visible = xlSheetVeryHidden
Sheets("Breakeven").Visible = xlSheetVeryHidden
Sheets("Cashflow").Visible = xlSheetVeryHidden
Sheets("Data Sensitization").Visible = xlSheetVeryHidden
Sheets("Executive Summary").Visible = xlSheetVeryHidden
Sheets("Data Input").Visible = xlSheetVeryHidden
Sheets("Calculations").Visible = xlSheetVeryHidden
End Sub
Private Sub Workbook_Open()
Sheets("Enable Macro").Visible = Range("Data Input C3")
Sheets("Cover").Visible = Range("Data Input C4")
Sheets("Key Assumptions").Visible = Range("Data Input C5")
Sheets("Notes").Visible = Range("Data Input C6")
Sheets("FF&E Master").Visible = Range("Data Input C7")
Sheets("Area Analisys").Visible = Range("Data Input C8")
Sheets("FF&E Price Input").Visible = Range("Data Input C9")
Sheets("Construction Costs").Visible = Range("Data Input C10")
Sheets("Depreciation").Visible = Range("Data Input C11")
Sheets("OE & Uniform").Visible = Range("Data Input C12")
Sheets("Payroll").Visible = Range("Data Input C13")
Sheets("P&L year 1").Visible = Range("Data Input C14")
Sheets("P&L year 1-5").Visible = Range("Data Input C15")
Sheets("Breakeven").Visible = Range("Data Input C16")
Sheets("Cashflow").Visible = Range("Data Input C17")
Sheets("Data Sensitization").Visible = Range("Data Input C18")
Sheets("Executive Summary").Visible = Range("Data Input C19")
Sheets("Data Input").Visible = Range("Data Input C20")
Sheets("Calculations").Visible = Range("Data Input C21")
Splash.Show
End Sub
|