I am getting a runtime error 1004, application defined or object defined error when I save this file. This only happens once I switch it onto be a 'shared workbook'
I have the following before save macro
Private Sub WORKBOOK_BEFORESAVE(ByVal SAVEASUI As Boolean, Cancel As Boolean)
If Sheets("Working Stats").Range("P2") > 5 Then
MsgBox "There is an error on row number " & Range("P2") & " You must enter a location. This file has not been saved"
If SAVEASUI = False Then
Cancel = True
End If
End If
With Worksheets("Weekly Figures")
.EnableSelection = xlNoRestrictions
.Protect Contents:=True, UserInterfaceOnly:=True
End With
End Sub
I also have the following worksheet code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
If Target.Column = 2 Then
Range(Target, Target.Offset(0, 8)).Interior.ColorIndex = 6
End If
End Sub
Can anyone see what of these might be leading to my error please ?
I have the following before save macro
Private Sub WORKBOOK_BEFORESAVE(ByVal SAVEASUI As Boolean, Cancel As Boolean)
If Sheets("Working Stats").Range("P2") > 5 Then
MsgBox "There is an error on row number " & Range("P2") & " You must enter a location. This file has not been saved"
If SAVEASUI = False Then
Cancel = True
End If
End If
With Worksheets("Weekly Figures")
.EnableSelection = xlNoRestrictions
.Protect Contents:=True, UserInterfaceOnly:=True
End With
End Sub
I also have the following worksheet code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
If Target.Column = 2 Then
Range(Target, Target.Offset(0, 8)).Interior.ColorIndex = 6
End If
End Sub
Can anyone see what of these might be leading to my error please ?