Show a Comment

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,050
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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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