ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   visible method of worksheet class failed error (https://www.excelbanter.com/excel-programming/424850-visible-method-worksheet-class-failed-error.html)

bigjim

visible method of worksheet class failed error
 
I am running exel 2003 and get a run-time error '1004 Visible method of
worksheet class failed. I am simply trying to go from one sheet that is
visible now <costsheet to another sheet <Main that is not visible now.
When I get to <main, I then want to hide <costsheet I have tried all the
tricks I know of to no avail and could use a little help. Here is my code:

ActiveWorkbook.Unprotect Password:="pw"
Dim Main As Worksheets

Worksheets("Main").Unprotect Password:="pw"


Worksheets("Main").Visible True <This is where it bogs down

Worksheets("Main").Range("d2").Select

Worksheets("costsheet").Visible False
Worksheets("Main").Protect Password:="pw"
ActiveWorkbook.Protect Password:="pw"


End Sub



All times are GMT +1. The time now is 06:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com