Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I update a cell every a few days with current date, like 11-1, 11-7,
11-10 I want to keep a record of the dates in comment. I am able to create a new comment or add a record to the existing commend. But how can I keep add data on top of exsing data in the comment, like 11-1 11-7 11-10 Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim PriorValue Dim Mycell As Range Dim cmt As Comment Set Mycell = Target PriorValue = Target.Text On Error Resume Next Set cmt = Mycell.Comment On Error GoTo 0 If Not cmt Is Nothing Then Mycell.Comment.Text privorvalue Else Mycell.AddComment PriorValue End If Target.Cells(1, 2).Activate End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Change as noted:
Set Mycell = Target PriorValue = Target.Text On Error Resume Next Set cmt = Mycell.Comment On Error GoTo 0 If Not cmt Is Nothing Then Mycell.Comment.Text (cmt & privorvalue) '<====== Change Else Mycell.AddComment PriorValue End If You might want to add a Chr(10) or Chr(13) between the previous and new comment text also. "Who I Am" wrote: I update a cell every a few days with current date, like 11-1, 11-7, 11-10 I want to keep a record of the dates in comment. I am able to create a new comment or add a record to the existing commend. But how can I keep add data on top of exsing data in the comment, like 11-1 11-7 11-10 Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim PriorValue Dim Mycell As Range Dim cmt As Comment Set Mycell = Target PriorValue = Target.Text On Error Resume Next Set cmt = Mycell.Comment On Error GoTo 0 If Not cmt Is Nothing Then Mycell.Comment.Text privorvalue Else Mycell.AddComment PriorValue End If Target.Cells(1, 2).Activate End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you for your reply.
However, the code stops at Mycell.Comment.Text (cmt & privorvalue) '<====== Change and I saw a run-time error "438" It appears to that comment only allows me to add data once, not multiple times. Can you please help? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
OK, now I know what happened. I should have added .text
Mycell.Comment.Text (cmt.text & privorvalue) '<====== Change Thank you Eric. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy comment content to cell content as data not as comment | Excel Discussion (Misc queries) | |||
Default date and time in the comment. | Excel Worksheet Functions | |||
How do I expand more than one comment box at same time? | Excel Discussion (Misc queries) | |||
run-time error 1004 & comment extraction | Excel Programming | |||
a comment plugin & copy paste directly from excel to comment ? fr. | Excel Worksheet Functions |