ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Uh oh...Runtime error 1004!!!! (https://www.excelbanter.com/excel-programming/356545-uh-oh-runtime-error-1004-a.html)

zenahs[_7_]

Uh oh...Runtime error 1004!!!!
 

Thanks to all of you that have helped me get my Excel workbook to wher
it is today. I now have a problem though...I think that two macros ar
conflicting. I currently have a button in use to run a macro that lock
and protects various cells in various worksheets throughout my workboo
(this is used to prevent end-users from editing or deleting my data o
these worksheets while, at the same time, leaving some cells open fo
their updating). The other macro that I am running is a "BeforeClose
macro that hides all worksheets upon closing (this is used to ensur
that end-users "enable" macros upon opening the workbook. If the
don't enable...they can't see the worksheets.)

Here is the error that I'm getting:
Runtime '1004'
Method 'Visible' of '_Worksheet' failed.

Is there a way to fix this? Is there a different way to accomplish th
same thing?

For reference purposes, here's the beforeclose macro I'm using:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("T2020").Select

x = MsgBox("Have you updated the T2020?", vbYesNo, "T2020 Reminder")

If x = vbNo Then
Cancel = True
End
End If
Dim WS As Worksheet

Sheets("PERMISSION").Visible = xlSheetVisible

For Each WS In ThisWorkbook.Worksheets
If Not WS.Name = "PERMISSION" Then
WS.Visible = xlSheetVeryHidden
End If
Next WS

End Sub

Thanks for your help

--
zenah
-----------------------------------------------------------------------
zenahs's Profile: http://www.excelforum.com/member.php...fo&userid=2868
View this thread: http://www.excelforum.com/showthread.php?threadid=52446



All times are GMT +1. The time now is 11:17 AM.

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