Como quitar error 1004 tiempo de ejecución
Sigo con mi programa y ahora al guardar me sale error 1004 error en tiempo de ejecución
Al cerrar sale error 1004 no se puede asignar la propiedad visible de la clase worksheet.
Esta es mi macro
Private Sub Workbook_Open()
For Each ws In ThisWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
Sheets("Inicio").Visible = xlVeryHidden
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Por.Miguel
Sheets("Inicio").Visible = xlSheetVisible
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Inicio" Then
ws.Visible = xlVeryHidden
End If
Next ws
ActiveWorkbook.Save
For Each h In Sheets
h.Unprotect "abc"
h.Cells.SpecialCells(xlCellTypeConstants, 23).Locked = True
h.Protect "abc", False, True, False, True, True, _
True, True, True, True, True, True, True, True, True
h.EnableSelection = xlNoRestrictions
Next
ActiveWorkbook.Save
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
'Por.Miguel
For Each h In Sheets
h.Unprotect "abc"
h.Cells.SpecialCells(xlCellTypeConstants, 23).Locked = True
h.Protect "abc", False, True, False, True, True, _
True, True, True, True, True, True, True, True, True
h.EnableSelection = xlNoRestrictions
Next
ActiveWorkbook.Save
End Sub