Updating Comments Dynamically From Cell Value in VB but gets truncated

steveconnolly

New Member
Joined
Sep 1, 2017
Messages
2
Hi,

Long time lurker, first time poster.

I'm am trying to populate the "comments" of a cell based on a combination of cells on another sheet (don't ask!).

Anyhow, let's assume we have SheetMain & SheetDesc. What I will want is for the comments on SheetMain to be taken from a number of specific cells on SheetDesc.

In the crudest form:

Code:
Selection.ClearComments

[A1].AddComment.Text "" & Format(Worksheets("SheetDesc").Range("A1")) & Chr(10) & Format(Worksheets("SheetDesc").Range("A2")) _
      & Chr(10) & Format(Worksheets("SheetDesc").Range("A3"))
      
       [A1].Comment.Shape.TextFrame.AutoSize = True

/CODE]

It works to a point - but what it is effectively doing is truncating the comments - but it is nowhere near the max o365 seems to specify (cuts randomly after pehaps 20 or 30 characters).

Is there a better way to concatenate and populate a comments box where the concatenation does not get truncated?

TIA. Steve.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try this

Code:
Sub Comment()
   With Sheets("SheetMain").Range("a1")
        .ClearComments
        .AddComment (Sheets("SheetDesc").Range("A1").Value & vbCrLf & Sheets("SheetDesc").Range("A2").Value & vbCrLf & Sheets("SheetDesc").Range("A3").Value)
        .Comment.Shape.TextFrame.AutoSize = True
    End With
    
End Sub

Thanks

Swapnil Shah
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top