Double click any cell in column A to open another sheet

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
781
Office Version
  1. 365
Hi,

how can I change the code below to open another sheet by double clicking in any cell in column A insted of just A2 cell:


VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Select Case Target.Address
 Case "$A$2"
            Sheets("GL MAPPING").Visible = True
            Sheets("GL MAPPING").Activate
End Sub
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I'm surprised that that code will compile without an End Select. Try
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Column = 1 Then
        Cancel = True
        Sheets("GL MAPPING").Visible = True
        Sheets("GL MAPPING").Activate
    End If
End Sub

edit: oops, should be .Column
 
Last edited:
Upvote 0
Or this...
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

    Select Case Target.Address
        Case "$A$" & Split(Target.Address, "$")(2)
            Sheets("GL MAPPING").Visible = True
            Sheets("GL MAPPING").Activate
    End Select

End Sub
 
Upvote 0
Solution
I'm glad if you found this as solution,
but depends what you are trying to do.
Mikerickson's solution is also well.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,562
Messages
6,125,546
Members
449,237
Latest member
Chase S

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