Double click any cell in column A to open another sheet

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
780
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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
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,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

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