Hi Guys,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o> </o>
I’ve just shared a workbook that I’ve created – problem is some of my macros have stopped working. When I run one of the macros, for example, I get a ‘Unprotect method of worksheet class failed’ message. I also think there’s an issue with the Show All Data aspect of the code. I’ve never had to share a workbook before so haven’t got a clue what changes I need to make.<o></o>
<o> </o>
Here’s the code;<o></o>
<o> </o>
Private Sub Period1Exceptions()<o></o>
'<o></o>
' Period1Exceptions Macro<o></o>
'<o></o>
<o> </o>
'<o></o>
Application.ScreenUpdating = False<o></o>
Application.Calculation = xlCalculationManual<o></o>
Sheet2.Select<o></o>
With ActiveSheet<o></o>
.Unprotect Password:="xxx"<o></o>
End With<o></o>
ActiveSheet.ShowAllData<o></o>
Range("B6:K306").Select<o></o>
Selection.Clear<o></o>
Sheet1.Select<o></o>
With ActiveSheet<o></o>
.Unprotect Password:="xxx"<o></o>
End With<o></o>
Range("B6:K306").Select<o></o>
Selection.Copy<o></o>
Sheet2.Select<o></o>
Range("B6").Select<o></o>
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _<o></o>
:=False, Transpose:=False<o></o>
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _<o></o>
SkipBlanks:=False, Transpose:=False<o></o>
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _<o></o>
SkipBlanks:=False, Transpose:=False<o></o>
Application.CutCopyMode = False<o></o>
Range("F6").Select<o></o>
Selection.FormulaR1C1 = "Last Supervision"<o></o>
Range("M7").Select<o></o>
Selection.FormulaHidden = True<o></o>
Range("B6").Select<o></o>
Range("B6:K306").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _<o></o>
Range("M6:M7"), Unique:=False<o></o>
Range("B6:K307").Select<o></o>
Selection.Locked = True<o></o>
Cells(2, 8).Value = Format(Now, "hh:mmampm dd/mm/yyyy")<o></o>
Sheet1.Select<o></o>
Range("A1").Select<o></o>
With ActiveSheet<o></o>
.Protect Password:="xxx"<o></o>
End With<o></o>
Sheet2.Select<o></o>
Range("A1").Select<o></o>
With ActiveSheet<o></o>
.Protect Password:="xxx"<o></o>
End With<o></o>
Application.Calculation = xlCalculationAutomatic<o></o>
Application.ScreenUpdating = True<o></o>
End Sub<o></o>
<o> </o>
Any help would be appreciated.<o></o>
<o> </o>
Thanks<o></o>
<o> </o>
I’ve just shared a workbook that I’ve created – problem is some of my macros have stopped working. When I run one of the macros, for example, I get a ‘Unprotect method of worksheet class failed’ message. I also think there’s an issue with the Show All Data aspect of the code. I’ve never had to share a workbook before so haven’t got a clue what changes I need to make.<o></o>
<o> </o>
Here’s the code;<o></o>
<o> </o>
Private Sub Period1Exceptions()<o></o>
'<o></o>
' Period1Exceptions Macro<o></o>
'<o></o>
<o> </o>
'<o></o>
Application.ScreenUpdating = False<o></o>
Application.Calculation = xlCalculationManual<o></o>
Sheet2.Select<o></o>
With ActiveSheet<o></o>
.Unprotect Password:="xxx"<o></o>
End With<o></o>
ActiveSheet.ShowAllData<o></o>
Range("B6:K306").Select<o></o>
Selection.Clear<o></o>
Sheet1.Select<o></o>
With ActiveSheet<o></o>
.Unprotect Password:="xxx"<o></o>
End With<o></o>
Range("B6:K306").Select<o></o>
Selection.Copy<o></o>
Sheet2.Select<o></o>
Range("B6").Select<o></o>
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _<o></o>
:=False, Transpose:=False<o></o>
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _<o></o>
SkipBlanks:=False, Transpose:=False<o></o>
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _<o></o>
SkipBlanks:=False, Transpose:=False<o></o>
Application.CutCopyMode = False<o></o>
Range("F6").Select<o></o>
Selection.FormulaR1C1 = "Last Supervision"<o></o>
Range("M7").Select<o></o>
Selection.FormulaHidden = True<o></o>
Range("B6").Select<o></o>
Range("B6:K306").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _<o></o>
Range("M6:M7"), Unique:=False<o></o>
Range("B6:K307").Select<o></o>
Selection.Locked = True<o></o>
Cells(2, 8).Value = Format(Now, "hh:mmampm dd/mm/yyyy")<o></o>
Sheet1.Select<o></o>
Range("A1").Select<o></o>
With ActiveSheet<o></o>
.Protect Password:="xxx"<o></o>
End With<o></o>
Sheet2.Select<o></o>
Range("A1").Select<o></o>
With ActiveSheet<o></o>
.Protect Password:="xxx"<o></o>
End With<o></o>
Application.Calculation = xlCalculationAutomatic<o></o>
Application.ScreenUpdating = True<o></o>
End Sub<o></o>
<o> </o>
Any help would be appreciated.<o></o>
<o> </o>
Thanks<o></o>