Help on Visible Property

  • Thread starter Thread starter Edy
  • Start date Start date
E

Edy

I would like to ask help from anyone in the group regarding the this
error everytime I run my macro. It used to run before but all of a
sudden, i don't know what went wrong, but it won't.

Macro code:
Worksheets("Tables").Visible=xlSheetVeryHidden

This is the error:
Run-time error '1004':
Unable to set the Visible property of the worksheet class.

Thanks for the help.
 
It works in 2003. I would make a simple macro with just the instruction and
try again.

Error 1004 usually means the item doesn't exist. If you have more than one
workbook make sure the active workbook contains the sheet Tables. Make sure
the sheet name is spelled Tables and there are no spaces in the sheet name.
If ther is more than one workbook include the workbookname

Workbooks("book1.xls").Worksheets("Tables").Visible=xlSheetVeryHidden
 
Thank you Joel. I tried to prefix my code with
Workbooks("Filename.xls"). to be more specific although that is the
only workbook open but the error is still the same. In the VB screen,
i tried to change the property of Visibility but still error occurs.
 
Is the workbook structure protected? If it is you will get that error.
The syntax
Worksheets("Tables").Visible=xlSheetVeryHidden
is fine

Mike
 
Is the workbook structure protected? If it is you will get that error.
The syntax
Worksheets("Tables").Visible=xlSheetVeryHidden
is fine

Mike

The syntax Tables.Visible = xlSheetVeryHidden is also good; this is
nice when you aren't 100% sure that the caption of the sheet won't
ever be changed ... you can change the Name of the sheet in VBE (under
properties).

Chris
 
Actually, I've seen (too often!) the "subscript out of range" error when the
item doesn't exist.
 
If it's the only visible sheet in the workbook, you'll get this error, too.

(as well as if the workbook's structure is protected--like Mike mentioned.
 
Thanks a lot guys for your posts/replies. I appreciated them. I am
learning from your posts.
I am not always online and now is the only time I read your replies.
Yes the workbook's structure is protected. (Thank you Mike).
 
Back
Top