Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
UserForm1.Show
Cancel=true
End Sub
Private Sub B_Ok_Click()
On Error Resume Next
With ActiveCell
.AddComment
On Error GoTo 0
.Comment.Text Text:=Replace(Me.TextBox1, Chr(13), "")
.Comment.Visible = True
.Comment.Shape.Select
Selection.AutoSize = True
.Comment.Visible = False
End With
Unload Me
End Sub
Private Sub UserForm_Initialize()
If ActiveCell.NoteText = "" Then
UserForm1.TextBox1 = Now & Chr(10) & Environ("username") & Chr(10)
Else
UserForm1.TextBox1 = ActiveCell.NoteText
End If
Me.Left = 300
Me.Top = 100
End Sub