Show a Comment

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,099
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Could someone help me with this code please?
From a d-click in Sheet1 I want to display a Comment that's in a different worksheet.
Its location is SheetAC Col Jxxx. xxx is "The RowNumber" below.

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
    Dim sh As Worksheet, p As String, TheRowNumber As Integer
    p = Cells(Target.Row, Target.Column)
    'get the Row Number in AC Sheet containing p
    TheRowNumber = FindRow(p, "AC")
    Set sh = Worksheets("AC")
    sh.Range("J" & TheRowNumber).Comment.Visible = True
End Sub

That doesn't seem to do anything. When corrected, would I see the popup comment (with Sheet1 active) or would I need sheet AC active?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Yes, you need to activate the AC sheet to see the pop-up comment on it.

Code:
    sh.Activate
An alternative to showing the comment pop-up and activating the sheet is to display the comment in a message box:
Code:
MsgBox Worksheets("AC").Range("J" & TheRowNumber).Comment.Text
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,171
Members
453,021
Latest member
Justyna P

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