hi
the following code always worked but know fails
the idea is when a file is open every sheet is shown if macros are enable
it always worked fine but now it shows only one sheet and don't hide sheet1
already tried in a new file and still works fine, only in this particular one it fails
tried to repair the file though open and repair but nothing happens
the macro was an open event, tried to run it as a regular macro (as shown) but the same occur
the strange is that if i run it a second time it works fine, only the first time this error occurs
anyone can tell me why and how to fix it
thanks
the following code always worked but know fails
Code:
Sub SubTeste()
Dim sh As Worksheet
For Each sh In Worksheets
sh.Visible = xlSheetVisible
Next sh
Worksheets("Sheet1").Visible = xlSheetVeryHidden
End Sub
the idea is when a file is open every sheet is shown if macros are enable
it always worked fine but now it shows only one sheet and don't hide sheet1
already tried in a new file and still works fine, only in this particular one it fails
tried to repair the file though open and repair but nothing happens
the macro was an open event, tried to run it as a regular macro (as shown) but the same occur
the strange is that if i run it a second time it works fine, only the first time this error occurs
anyone can tell me why and how to fix it
thanks