Open Worksheet by Double Click on a Cell

This post will guide you how to use a VBA code to open a specified worksheet by double click on a cell in Excel. How to quickly open a worksheet by double click a cell in Excel.

Open Worksheet by Double Click on a Cell


Assuming that you want to double click on cell B1, then it should be open another worksheet sheet2 quickly in your current worksheet. Just do the following steps:

#1 select the worksheet sheet1 which contains the cell that you want to double click on it.

#2 right click on the sheet name, select view Code menu from the pop-up menu list.

open worksheet by doulbeclick1

#3 the Microsoft Visual Basic for Applications window will appear. Then type the following VBA code in the code window.

open worksheet by doulbeclick2

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Not Intersect(Target, Range("B1")) Is Nothing Then
        Sheets(“sheet2”).Activate
    End If
End Sub

Note: you can replace the sheet name (sheet2) as you need.

#4 close the Microsoft Visual Basic for Applications window. You can try to double click on Cell B1, the sheet2 worksheet should be opened.

 

Leave a Reply