Open Tab with cell selection.

craigwojo

Active Member
Joined
Jan 7, 2005
Messages
274
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,
Is there a way to have a tab, let's say, "VINYL" open up when you click on a cell, let's say, "E27"?

Thank you and God bless,
Craig
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Use worksheet event code below.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("E27")) Is Nothing Then
Sheets("VINYL").Activate
End If
End Sub
How to use worksheet event the code
Right click on Sheet tab --> view code
Visual Basic (VB) window opens.
Paste the code
Close the VB window.
Save the file as .xlsm
 
Upvote 0
Use worksheet event code below.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("E27")) Is Nothing Then
Sheets("VINYL").Activate
End If
End Sub
How to use worksheet event the code
Right click on Sheet tab --> view code
Visual Basic (VB) window opens.
Paste the code
Close the VB window.
Save the file as .xlsm
I agree with the solution, maybe I would also add:

To open it in a new window:
Dim newWindow As Window
Set newWindow = ThisWorkbook.NewWindow
newWindow.Activate
ThisWorkbook.Sheets("VINYL").Activate


Add an error handler:

On Error Resume Next
(Rest of code)
On Error GoTo 0
 
Upvote 0
Use worksheet event code below.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("E27")) Is Nothing Then
Sheets("VINYL").Activate
End If
End Sub
How to use worksheet event the code
Right click on Sheet tab --> view code
Visual Basic (VB) window opens.
Paste the code
Close the VB window.
Save the file as .xlsmThe TA
The cell "K27" that needs to be selected is on the TAB called "TITLE" and would open the TAB called "METAL" and open up to the top of the page on METAL TAB. Sorry about not saying what the actual worksheet data is.
Thank you again.
 
Upvote 0
The cell "K27" that needs to be selected is on the TAB called "TITLE" and would open the TAB called "METAL" and open up to the top of the page on METAL TAB. Sorry about not saying what the actual worksheet data is.
Just modify the code given to you to match those minor changes (change range name and sheet name), and then select the first cell on that Sheet:
Rich (BB code):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("K27")) Is Nothing Then
        Sheets("METAL").Activate
        Range("A1").Select
    End If
End Sub

In order to get this to run against the "TITLE" tab, this code MUST be placed in the "TITLE" worksheet module in VBA.
"Worksheet_SelectionChange" event procedure code ALWAYS goes in Sheet modules in VBA, never in the "ThisWorkbook" or General modules.
An easy way to make sure you put it in the correct place is to go to the "TITLE" sheet, right-click on the Sheet tab name at the bottom of the screen, select "View Code", and then paste this code in the VB Editor window that pops up.
 
Upvote 0
Hi everyone,
Thank you for your help. I ended up HYPERLINKing the cell to the tab. It works.

Thak you and God bless,
Craig
 
Upvote 0
Solution

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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