Boa tarde Alexandre!
Na verdade já tenho uma vba para proteger e desproteger a planilha e ela rodava perfeitamente. Com a inclusão dessas três novas macros para alteração de cor da fonte que apresentou o erro 1004.
Segue código de proteção:
Sub Macro()
Worksheets("ORÇAMENTO 2015").Unprotect "finprotege"
Worksheets("FC-REAL JAN").Unprotect "finprotege"
Worksheets("FC-REAL FEV").Unprotect "finprotege"
Worksheets("FC-REAL MAR").Unprotect "finprotege"
Worksheets("FC-REAL ABR").Unprotect "finprotege"
Worksheets("FC-REAL MAI").Unprotect "finprotege"
Worksheets("FC-REAL JUN").Unprotect "finprotege"
Worksheets("FC-REAL JUL").Unprotect "finprotege"
Worksheets("FC-REAL AGO").Unprotect "finprotege"
Worksheets("FC-REAL SET").Unprotect "finprotege"
Worksheets("FC-REAL OUT").Unprotect "finprotege"
Worksheets("FC-REAL NOV").Unprotect "finprotege"
Worksheets("FC-REAL DEZ").Unprotect "finprotege"
Worksheets("REALIZADO TOTAL").Unprotect "finprotege"
Worksheets("DR - JAN").Unprotect "finprotege"
Worksheets("DR - FEV").Unprotect "finprotege"
Worksheets("DR - MAR").Unprotect "finprotege"
Worksheets("DR - ABR").Unprotect "finprotege"
Worksheets("DR - MAI").Unprotect "finprotege"
Worksheets("DR - JUN").Unprotect "finprotege"
Worksheets("DR - JUL").Unprotect "finprotege"
Worksheets("DR - AGO").Unprotect "finprotege"
Worksheets("DR - SET").Unprotect "finprotege"
Worksheets("DR - OUT").Unprotect "finprotege"
Worksheets("DR - NOV").Unprotect "finprotege"
Worksheets("DR - DEZ").Unprotect "finprotege"
' Macro Macro
' Visão Macro
'
' Atalho do teclado: Ctrl+m
'
ActiveSheet.Outline.ShowLevels RowLevels:=1
Worksheets("ORÇAMENTO 2015").Protect "finprotege"
Worksheets("FC-REAL JAN").Protect "finprotege"
Worksheets("FC-REAL FEV").Protect "finprotege"
Worksheets("FC-REAL MAR").Protect "finprotege"
Worksheets("FC-REAL ABR").Protect "finprotege"
Worksheets("FC-REAL MAI").Protect "finprotege"
Worksheets("FC-REAL JUN").Protect "finprotege"
Worksheets("FC-REAL JUL").Protect "finprotege"
Worksheets("FC-REAL AGO").Protect "finprotege"
Worksheets("FC-REAL SET").Protect "finprotege"
Worksheets("FC-REAL OUT").Protect "finprotege"
Worksheets("FC-REAL NOV").Protect "finprotege"
Worksheets("FC-REAL DEZ").Protect "finprotege"
Worksheets("REALIZADO TOTAL").Protect "finprotege"
Worksheets("DR - JAN").Protect "finprotege"
Worksheets("DR - FEV").Protect "finprotege"
Worksheets("DR - MAR").Protect "finprotege"
Worksheets("DR - ABR").Protect "finprotege"
Worksheets("DR - MAI").Protect "finprotege"
Worksheets("DR - JUN").Protect "finprotege"
Worksheets("DR - JUL").Protect "finprotege"
Worksheets("DR - AGO").Protect "finprotege"
Worksheets("DR - SET").Protect "finprotege"
Worksheets("DR - OUT").Protect "finprotege"
Worksheets("DR - NOV").Protect "finprotege"
Worksheets("DR - DEZ").Protect "finprotege"
End Sub
Sub Sintético()
Worksheets("ORÇAMENTO 2015").Unprotect "finprotege"
Worksheets("FC-REAL JAN").Unprotect "finprotege"
Worksheets("FC-REAL FEV").Unprotect "finprotege"
Worksheets("FC-REAL MAR").Unprotect "finprotege"
Worksheets("FC-REAL ABR").Unprotect "finprotege"
Worksheets("FC-REAL MAI").Unprotect "finprotege"
Worksheets("FC-REAL JUN").Unprotect "finprotege"
Worksheets("FC-REAL JUL").Unprotect "finprotege"
Worksheets("FC-REAL AGO").Unprotect "finprotege"
Worksheets("FC-REAL SET").Unprotect "finprotege"
Worksheets("FC-REAL OUT").Unprotect "finprotege"
Worksheets("FC-REAL NOV").Unprotect "finprotege"
Worksheets("FC-REAL DEZ").Unprotect "finprotege"
Worksheets("REALIZADO TOTAL").Unprotect "finprotege"
Worksheets("DR - JAN").Unprotect "finprotege"
Worksheets("DR - FEV").Unprotect "finprotege"
Worksheets("DR - MAR").Unprotect "finprotege"
Worksheets("DR - ABR").Unprotect "finprotege"
Worksheets("DR - MAI").Unprotect "finprotege"
Worksheets("DR - JUN").Unprotect "finprotege"
Worksheets("DR - JUL").Unprotect "finprotege"
Worksheets("DR - AGO").Unprotect "finprotege"
Worksheets("DR - SET").Unprotect "finprotege"
Worksheets("DR - OUT").Unprotect "finprotege"
Worksheets("DR - NOV").Unprotect "finprotege"
Worksheets("DR - DEZ").Unprotect "finprotege"
' Sintético Macro
' Visão Sintética
'
' Atalho do teclado: Ctrl+s
'
ActiveSheet.Outline.ShowLevels RowLevels:=2
Worksheets("ORÇAMENTO 2015").Protect "finprotege"
Worksheets("FC-REAL JAN").Protect "finprotege"
Worksheets("FC-REAL FEV").Protect "finprotege"
Worksheets("FC-REAL MAR").Protect "finprotege"
Worksheets("FC-REAL ABR").Protect "finprotege"
Worksheets("FC-REAL MAI").Protect "finprotege"
Worksheets("FC-REAL JUN").Protect "finprotege"
Worksheets("FC-REAL JUL").Protect "finprotege"
Worksheets("FC-REAL AGO").Protect "finprotege"
Worksheets("FC-REAL SET").Protect "finprotege"
Worksheets("FC-REAL OUT").Protect "finprotege"
Worksheets("FC-REAL NOV").Protect "finprotege"
Worksheets("FC-REAL DEZ").Protect "finprotege"
Worksheets("REALIZADO TOTAL").Protect "finprotege"
Worksheets("DR - JAN").Protect "finprotege"
Worksheets("DR - FEV").Protect "finprotege"
Worksheets("DR - MAR").Protect "finprotege"
Worksheets("DR - ABR").Protect "finprotege"
Worksheets("DR - MAI").Protect "finprotege"
Worksheets("DR - JUN").Protect "finprotege"
Worksheets("DR - JUL").Protect "finprotege"
Worksheets("DR - AGO").Protect "finprotege"
Worksheets("DR - SET").Protect "finprotege"
Worksheets("DR - OUT").Protect "finprotege"
Worksheets("DR - NOV").Protect "finprotege"
Worksheets("DR - DEZ").Protect "finprotege"
End Sub
Sub Aberto()
Worksheets("ORÇAMENTO 2015").Unprotect "finprotege"
Worksheets("FC-REAL JAN").Unprotect "finprotege"
Worksheets("FC-REAL FEV").Unprotect "finprotege"
Worksheets("FC-REAL MAR").Unprotect "finprotege"
Worksheets("FC-REAL ABR").Unprotect "finprotege"
Worksheets("FC-REAL MAI").Unprotect "finprotege"
Worksheets("FC-REAL JUN").Unprotect "finprotege"
Worksheets("FC-REAL JUL").Unprotect "finprotege"
Worksheets("FC-REAL AGO").Unprotect "finprotege"
Worksheets("FC-REAL SET").Unprotect "finprotege"
Worksheets("FC-REAL OUT").Unprotect "finprotege"
Worksheets("FC-REAL NOV").Unprotect "finprotege"
Worksheets("FC-REAL DEZ").Unprotect "finprotege"
Worksheets("REALIZADO TOTAL").Unprotect "finprotege"
Worksheets("DR - JAN").Unprotect "finprotege"
Worksheets("DR - FEV").Unprotect "finprotege"
Worksheets("DR - MAR").Unprotect "finprotege"
Worksheets("DR - ABR").Unprotect "finprotege"
Worksheets("DR - MAI").Unprotect "finprotege"
Worksheets("DR - JUN").Unprotect "finprotege"
Worksheets("DR - JUL").Unprotect "finprotege"
Worksheets("DR - AGO").Unprotect "finprotege"
Worksheets("DR - SET").Unprotect "finprotege"
Worksheets("DR - OUT").Unprotect "finprotege"
Worksheets("DR - NOV").Unprotect "finprotege"
Worksheets("DR - DEZ").Unprotect "finprotege"
' Aberto Macro
' Visão Aberta
'
' Atalho do teclado: Ctrl+a
'
ActiveSheet.Outline.ShowLevels RowLevels:=3
Worksheets("ORÇAMENTO 2015").Protect "finprotege"
Worksheets("FC-REAL JAN").Protect "finprotege"
Worksheets("FC-REAL FEV").Protect "finprotege"
Worksheets("FC-REAL MAR").Protect "finprotege"
Worksheets("FC-REAL ABR").Protect "finprotege"
Worksheets("FC-REAL MAI").Protect "finprotege"
Worksheets("FC-REAL JUN").Protect "finprotege"
Worksheets("FC-REAL JUL").Protect "finprotege"
Worksheets("FC-REAL AGO").Protect "finprotege"
Worksheets("FC-REAL SET").Protect "finprotege"
Worksheets("FC-REAL OUT").Protect "finprotege"
Worksheets("FC-REAL NOV").Protect "finprotege"
Worksheets("FC-REAL DEZ").Protect "finprotege"
Worksheets("REALIZADO TOTAL").Protect "finprotege"
Worksheets("DR - JAN").Protect "finprotege"
Worksheets("DR - FEV").Protect "finprotege"
Worksheets("DR - MAR").Protect "finprotege"
Worksheets("DR - ABR").Protect "finprotege"
Worksheets("DR - MAI").Protect "finprotege"
Worksheets("DR - JUN").Protect "finprotege"
Worksheets("DR - JUL").Protect "finprotege"
Worksheets("DR - AGO").Protect "finprotege"
Worksheets("DR - SET").Protect "finprotege"
Worksheets("DR - OUT").Protect "finprotege"
Worksheets("DR - NOV").Protect "finprotege"
Worksheets("DR - DEZ").Protect "finprotege"
End Sub
Postado : 12/01/2015 10:18 am