Automatically updating comments across worksheets

svk01

New Member
Joined
Mar 19, 2021
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hello, I am using VBA code extracted from Andrew Poulsom's prior post. My version is pasted below:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
With Worksheets("HeatMap - Strengths+Weaknesses")
Select Case Target.Address
Case "$F$2"
.Range("F2").Comment.Text Text:=Target.Value
Case "$F$3"
.Range("F3").Comment.Text Text:=Target.Value
End Select
End With
End Sub

However, when I try to run this code I continuously receive an "argument not optional" error and despite many hours of debugging I cannot figure out how to fix it. For your reference, the below code has been attached to a sheet called "All Responses." This sheet contains data that has been copied into comments placed in a second sheet (within the same workbook) called "HeatMap - Strengths+Weaknesses." As you can probably tell, the locations of the originating cells in "All Responses" mirrors those in "HeatMap - Strengths+Weaknesses" because the aim here is to use the comment to elaborate on a score given to each response in "All Responses." Do you have any idea why the compiler is not receiving an argument and is thus outputting this error? By the way, I am unaware of the exact code posing problems because it doesn't highlight any code when the error is outputted.
 

svk01

New Member
Joined
Mar 19, 2021
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Yessss @Fluff, you wizard, thank you!!! That finally worked! Is there any way per chance to delete the old comment too?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,536
Office Version
  1. 365
Platform
  1. Windows
Use this instead
VBA Code:
.Range("F2").CommentThreaded.Text Target.Value
 
Solution

svk01

New Member
Joined
Mar 19, 2021
Messages
16
Office Version
  1. 365
Platform
  1. Windows
THANK YOU SO MUCH!!! I am eternally grateful.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,536
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

svk01

New Member
Joined
Mar 19, 2021
Messages
16
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

One last question if you don't mind - is it possible to set this code for a range of cells? i.e. to set it such that F2:F36 in one sheet maps to comments in F2:F36 in the other sheet?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,536
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Target.CountLarge > 1 Then Exit Sub
   If Not Intersect(Target, Range("F2:F36")) Is Nothing Then
      With Worksheets("HeatMap - Strengths+Weaknesses")
         .Range(Target.Address).CommentThreaded.Text Target.Value
      End With
   End If
End Sub
This assumes you will only change one cell at a time.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,536
Office Version
  1. 365
Platform
  1. Windows
My pleasure. :)
 

Watch MrExcel Video

Forum statistics

Threads
1,129,499
Messages
5,636,688
Members
416,935
Latest member
Atulcp

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
Top