Excel VBA editing comment if exists

Multi tool use
Multi tool use


Excel VBA editing comment if exists



My code is checking if cell value from 2 sheets are different, if no it continue check for next row, if different it copy from sheet2 to sheet1 the cell value where I need and add to Cell in sheet1(where the value copied too) a comment with the old value.
every time when the value changed again it remove the comment and put new one.
I need to do a comment check if exist and append the old value to comment.
I want that the comment will contain all the old values that changed in the cell.



this is my piece of code:


If Not IsEmpty(datasheet.Cells(iData, j).Value) Then
comm = user & vbNewLine & "Old Date:" & vbNewLine & ActiveCell.Value
datasheet.Cells(iData, j).Copy Destination:=ActiveCell
With ActiveCell
ActiveCell.Interior.ColorIndex = 0
With ActiveCell.Borders
.LineStyle = xlContinuous 'Setting style of border line
.Weight = xlThin 'Setting weight of border line
.ColorIndex = xlAutomatic 'Setting colour of border line
End With
If Not .Comment Is Nothing Then .Comment.Delete
.ClearComments
.AddComment
.Comment.Text Text:=comm
.Comment.Visible = False
End With





not much code or context there.
– AJD
Jun 28 at 20:17





ActiveCell? How do you get the active cell?
– AJD
Jun 28 at 20:18


ActiveCell





with .Find, on sheet2 running on all rows in a column and in sheet 1 I "Find" it, when it founded its the ActiveCell
– Ang3lStyl3X
Jul 1 at 3:45



.Find


ActiveCell





Is there a question here? You have a code and I assume it works.
– AJD
Jul 1 at 3:56





its works just for adding new comment all the time. I asked for editing comments if its exists
– Ang3lStyl3X
Jul 1 at 5:16










By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

aOS22ER57tnQ Wxjht2KScsogKvJa2 hib pZN6,eYZNOsQim 4p,HqtPh
n0,CxGJl4t8,t4e,SXxHRXpESD

Popular posts from this blog

PySpark - SparkContext: Error initializing SparkContext File does not exist

django NoReverseMatch Exception

List of Kim Possible characters