Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with hidden worksheet

Status
Not open for further replies.

ken2834

Technical User
Jun 26, 2006
27
US
I am trying to fix an Excel macro that was coded by someone who is no longer around. When I run it, I get a "Reference is not Valid" error, I think because the sheet the code is trying to reference is hidden. I have tried to unhide the sheet, and I have been unable to. However if I loop through all of the worksheets in the workbook, I can see the sheet exists. I have tried

Worksheets(1).Visible = True
and
sheets("Cash Flows").Visible = True

How can I unhide this worksheet?
 
My shoot from the hip response would be to check and see if the sheet or workbook can be unprotected first then try to unhide the sheet.



Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
I think the workbook is password protected but I don't know the password. Is it possible to hack into this somehow?
 
As I never condone "hacking" a file, albeit legal or not (I've dealt with these A LOT) I would recommend buying commercial software to do this. It's fairly cheap, starting at about $40 USD for a decent program. If it's work related, your employer shouldn't have that big of a problem forking over such a small amount. Probably the most popular I've seen is here...


Yes, there are other ways about it, but we can't be posting them in public and having all the worlds hackers getting them now can we. ;)

-----------
Regards,
Zack Barresse
 
As firefytr says, we cant be posting other methods here. We purchased the office utility from lostpasswords several years ago and it works like a charm. I think you have to get the wb unprotected before you can proceed to fix the rest of your problem. I believe your problem is linked to the protection.



Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
It seems to me you want this sheet unhidden because it might be causing an error. However, hidden sheets are still very visible to code. The fact that the sheet is hidden should not cause an error when referencing it. The error you get suggests the way the sheet is called is incorrect.

I'd double-check if the name of the sheet is spelled correctly throughout the code.

Cheers,

Roel
 
Although code can still ref a sheet when it is hidden, I made my suggestion based on his original code tring to make the sheet visible. If there is other code producing an error you should post it here so we can look at the original problem.

Thanks


Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top