Double click any cell in column A to open another sheet

josros60

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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,983
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:

EXCEL MAX

Active Member
Joined
Nov 11, 2020
Messages
392
Office Version
  1. 2016
Platform
  1. Windows
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
 
Solution

EXCEL MAX

Active Member
Joined
Nov 11, 2020
Messages
392
Office Version
  1. 2016
Platform
  1. Windows
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:

Watch MrExcel Video

Forum statistics

Threads
1,129,590
Messages
5,637,285
Members
416,963
Latest member
samfuge

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
Top