Difficulty coming up with the right VBA code to make comment boxes on one worksheet automatically update from values on another worksheet

carolinemorris79

New Member
Joined
Mar 3, 2015
Messages
1
I have a workbook with several worksheet tabs. One of the worksheet tab contains a column of percentages (that are composed of a VLookup formula from another tab), and a column with relevant text. I want the information from these two columns to appear as comments in a separate worksheet. I would also like them to automatically update if the percentages are updated or if the text is updated. I found a way to insert the comments with the code below, but I don't know how to update them (I presume it is some sort of private sub_worksheet change or private_sub_worksheet_calculate but I can't see to find the right formula that takes the whole range.

Here is what i have (but it won't update the comments; the code only runs once):

Sub ValueToComment()

Set shSource = ThisWorkbook.Sheets("Percentage Table")
Set shDest = ThisWorkbook.Sheets("dashboard2decisionmakers")
Dim lCnt As Long

For Each c In shDest.Range("s2:z2", "s3:z3")
c.AddComment.Text shSource.Range("e3").Offset(lCnt, 0).Value * 100 & "% complete : " & shSource.Range("e3").Offset(lCnt, 3).Value
lCnt = lCnt + 1
Next c


End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,216,494
Messages
6,130,977
Members
449,611
Latest member
Bushra

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