Double Click to Open Specified Worksheet in Excel



Excel is a powerful data-organization and analysis tool, and this function allows you to rapidly browse between worksheets inside your workbook by double?clicking on a cell. This guide will lead you through the steps of configuring this functionality in Excel. Whether you're a novice or a seasoned Excel user, this video will provide you with the skills you need to improve your productivity and make navigating between worksheets more efficient.

Double Click A Cell To Open A Specified Worksheet

Here we will use the VBA code to complete the task. So let us see a simple process to learn how you can double?click a cell to open a specified worksheet in Excel.

Step 1

Consider any Excel workbook that contains multiple worksheets.

First, right?click on the sheet name and select "View Code" to open the VBA application.

Step 2

Then copy the below code into the text box.

Code

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim xArray, xAValue As Variant
Dim xFNum As Long
Dim xStr, xStrRg, xStrSheetName As String
xRgArray = Array("A1;Sheet2", "A2;Sheet3", "A3;Sheet4", "A4;Sheet5")
On Error Resume Next
For xFNum = LBound(xRgArray) To UBound(xRgArray)
xStr = ""
xStr = xRgArray(xFNum)
xAValue = ""
xAValue = Split(xStr, ";")
xStrRg = ""
xStrRg = xAValue(0)
xStrSheetName = ""
xStrSheetName = xAValue(1)
If Not Intersect(Target, Range(xStrRg)) Is Nothing Then
Sheets(xStrSheetName).Activate
End If
Next
End Sub

This code will open Sheet2, Sheet3, Sheet4, and Sheet5 when double?clicking on A1, A2, A3, and A4 cells, respectively.

Step 3

Then use Alt + Q to close the VBA and complete the task.

Conclusion

In this tutorial, we have used a simple process to show how you can double?click a cell to open a specified worksheet in Excel to highlight a particular set of data.

Updated on: 2023-07-13T11:37:08+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements