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

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
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,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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