I have two versions of the same file and they share the same sheet structure and the same workbook_open event function as follows
Private Sub Workbook_Open()
Dim ws As Worksheet
With ThisWorkbook.Worksheets("QCT Global")
With .DeliveryLot
.Clear
.AddItem "Current Lot"
.AddItem "Manual Lot"
.Value = ThisWorkbook.Worksheets("QCT Global").Range("E3")
End With
.Visible = xlSheetVisible
.Activate
.Cells(1, 1).Select
ActiveWindow.Zoom = 65
End With
For Each ws In ThisWorkbook.Worksheets
If Not ws.Name = "QCT Global" Then
ws.Visible = xlSheetVeryHidden
End If
Next ws
End Sub
for some reason one of the versions gives Run-time error 1004 when it arrives at line
ws.Visible = xlSheetVeryHidden
Run-time error 1004
method "Visible" of object "_worksheet" failed
but I cannot understand why. (in the other file with the same workbook_open event there are no issues)
ws is indeed each of the worksheets and I can access its properties through the inmediate window, but for some reason does not allow changing its visible attributes
any clues of what may be going on?
thanks!
Bookmarks