I have this code in my worksheet:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim cmtText As String
Cancel = True
Me.Unprotect "Thermo544"
cmtText = InputBox("Enter Comment")
If cmtText = "" Then
Me.Protect "Thermo544"
Exit Sub
End If
Target.ClearComments
Target.AddComment
Target.Comment.Text Text:=cmtText
Me.Protect "Thermo544"
End Sub
I get the run-time error 1004 message: "Method 'Unprotect' of object '_Worksheet' failed" when I try to run the macro in a shared workbook. Any suggestions on how this macro can be enabled to run in a shared workbook?
Thanks
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim cmtText As String
Cancel = True
Me.Unprotect "Thermo544"
cmtText = InputBox("Enter Comment")
If cmtText = "" Then
Me.Protect "Thermo544"
Exit Sub
End If
Target.ClearComments
Target.AddComment
Target.Comment.Text Text:=cmtText
Me.Protect "Thermo544"
End Sub
I get the run-time error 1004 message: "Method 'Unprotect' of object '_Worksheet' failed" when I try to run the macro in a shared workbook. Any suggestions on how this macro can be enabled to run in a shared workbook?
Thanks