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.
Joel - 12 Apr 2008 08:28 GMT
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
> 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
[quoted text clipped - 8 lines]
>
> Thanks for the help.
Edy - 12 Apr 2008 09:10 GMT
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.
Mike H - 12 Apr 2008 09:29 GMT
Is the workbook structure protected? If it is you will get that error.
The syntax
Worksheets("Tables").Visible=xlSheetVeryHidden
is fine
Mike
> 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.
cht13er - 12 Apr 2008 13:33 GMT
> Is the workbook structure protected? If it is you will get that error.
> The syntax
[quoted text clipped - 7 lines]
> > 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.
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
Dave Peterson - 12 Apr 2008 14:42 GMT
Actually, I've seen (too often!) the "subscript out of range" error when the
item doesn't exist.
> It works in 2003. I would make a simple macro with just the instruction and
> try again.
[quoted text clipped - 18 lines]
> >
> > Thanks for the help.

Signature
Dave Peterson
Dave Peterson - 12 Apr 2008 14:44 GMT
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.
> 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
[quoted text clipped - 8 lines]
>
> Thanks for the help.

Signature
Dave Peterson
Edy - 26 Apr 2008 07:04 GMT
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).