Help on Visible Property

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.
 
J

Joel

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
 
E

Edy

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.
 
M

Mike H

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

Mike
 
C

cht13er

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
 
D

Dave Peterson

Actually, I've seen (too often!) the "subscript out of range" error when the
item doesn't exist.
 
D

Dave Peterson

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.
 
E

Edy

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top