View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tim[_36_] Tim[_36_] is offline
external usenet poster
 
Posts: 16
Default Unhide sheets based on a cell value

Hi, this problem is driving me nuts.

I have a macro warning page (shows only the warning unless you enable
macros) and can close my workbook, hiding all pages except the macro
warning page in the process.

I cannot for the life of me get any code to work when i open my
workbook.
What I have is:

1/ 21 worksheets including the macro warning sheet
2/ upon opening the workbook I want to 'very hide' 3 (or sometimes
more) sheets based upon values I have in cells.
3/ I place the values in the sheet named "Data" in a range D3:D24
4/ The cells in the range return the value TRUE or FALSE based on
the visible properties I want the sheet to have. (I set these values
by checkboxs linked to the range above).
5/ I an currently using the code (applies to two of the 21 sheetsfor
this example)

Sheets("Cover").Visible = Sheets("Data").Range("D4").Value
Sheets("KA").Visible = Sheets("Data").Range("D5").Value

and so on for the 21 sheets....
This code is used in the workbook open section.

I get the error upon opening the workbook
Error 9 script out of range

This must be either very complicated or I am very dense...could go
either way.
Any help would be appreciated.
Thanks
Tim