Macro to Double click on Note to Select E4

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,570
Office Version
  1. 2021
Platform
  1. Windows
i have a note pertaining to E4. I have tried to write code so that if I double click the note that the cursor will go to cell E4

When clicking on the note , nothing happens


It would be appreciated if someone could amend my code


Code:
 Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim rng As Range
    Dim noteRange As Range
    
    Set rng = Me.Cells.SpecialCells(xlCellTypeComments) ' Get all cells with notes
    
    If rng.Cells.Count > 0 Then
        For Each noteRange In rng
            If Not noteRange.Comment Is Nothing Then
                If Not Intersect(Target, noteRange.Comment.Shape.TopLeftCell) Is Nothing Then
                    Application.Goto Me.Range("E4") ' Go to the specified cell (E4)
                    Exit Sub
                End If
            End If
        Next noteRange
    End If
End Sub [code]
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,216,077
Messages
6,128,685
Members
449,463
Latest member
Jojomen56

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