Hi Guys,
I have the following code to add a comment each time a cell value changes, however if I change the Range to "N25" everything works perfectly, but if I want to have the code to cover all rows in column "N" I don't get any comment appear when the value changes.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range
Set Rng = Range("N:N")
On Error Resume Next
If Rng.Comment Is Nothing And Len(Rng.Value) > 0 Then
Rng.AddComment Now & "-" & Rng.Value
Else
Rng.Comment.Text vbNewLine & Now & "-" & Rng.Value, Len(Rng.Comment.Text) + 1
End If
Rng.Comment.Shape.TextFrame.AutoSize = True
End Sub
Thanks,
Gavin
I have the following code to add a comment each time a cell value changes, however if I change the Range to "N25" everything works perfectly, but if I want to have the code to cover all rows in column "N" I don't get any comment appear when the value changes.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range
Set Rng = Range("N:N")
On Error Resume Next
If Rng.Comment Is Nothing And Len(Rng.Value) > 0 Then
Rng.AddComment Now & "-" & Rng.Value
Else
Rng.Comment.Text vbNewLine & Now & "-" & Rng.Value, Len(Rng.Comment.Text) + 1
End If
Rng.Comment.Shape.TextFrame.AutoSize = True
End Sub
Thanks,
Gavin