Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to click a cell with mouse and have a different tab appear
I was wondering if there is a way where I can click say cell A1 which
currently has the text 'Tuesday' in it. By clicking on this cell, the user is directed to a new tab (which the user has labelled as Tuesday). My knowledge is somewhat limited. I know I can run a macro and then press <CTRL and the short cut key, but I was hoping to be able to just use the mouse and click on the cell to direct me to the new tab. Any suggestions would be greatly appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to click a cell with mouse and have a different tab appear
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "A1" '<== change to suit Dim sh As Worksheet If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target On Error Resume Next If Not Me.Parent.Worksheets(.Value) Is Nothing Then Me.Parent.Worksheets(.Value).Activate End If End With End If End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- __________________________________ HTH Bob "Randy Carriere" <Randy wrote in message ... I was wondering if there is a way where I can click say cell A1 which currently has the text 'Tuesday' in it. By clicking on this cell, the user is directed to a new tab (which the user has labelled as Tuesday). My knowledge is somewhat limited. I know I can run a macro and then press <CTRL and the short cut key, but I was hoping to be able to just use the mouse and click on the cell to direct me to the new tab. Any suggestions would be greatly appreciated. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to click a cell with mouse and have a different tab appear
I would be inclined to use double click. It is hard to accidentally double
click a cell. Here is some code for you. Right click the sheet tab you want this to work in and select View Code. Paste the following... It works on double clicking cells A1 or A2 and takes you to the sheet named in the cell. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim wks As Worksheet If Not Intersect(Target, Me.Range("A1:A2")) Is Nothing Then Cancel = True On Error Resume Next Set wks = Sheets(Target.Value) On Error GoTo 0 If wks Is Nothing Then MsgBox "Sheet " & Target.Value & " does not exist." Else wks.Select End If End If End Sub -- HTH... Jim Thomlinson "Randy Carriere" wrote: I was wondering if there is a way where I can click say cell A1 which currently has the text 'Tuesday' in it. By clicking on this cell, the user is directed to a new tab (which the user has labelled as Tuesday). My knowledge is somewhat limited. I know I can run a macro and then press <CTRL and the short cut key, but I was hoping to be able to just use the mouse and click on the cell to direct me to the new tab. Any suggestions would be greatly appreciated. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to click a cell with mouse and have a different tab appear
Doubleclick event code could work.
Private Sub Worksheet_BeforeDoubleClick( _ ByVal Target As Excel.Range, Cancel As Boolean) 'Substitute your cells/sheetnames Select Case Target.Address(False, False) Case "A1" Sheets(Target.Value).Select Case "A2" Sheets(Target.Value).Select Case "A3" Sheets(Target.Value).Select End Select Cancel = True End Sub This is sheet event code. Right-click on the sheet tab and "View Code". Copy/paste into that sheet module. Gord Dibben MS Excel MVP On Thu, 19 Jun 2008 13:26:02 -0700, Randy Carriere <Randy wrote: I was wondering if there is a way where I can click say cell A1 which currently has the text 'Tuesday' in it. By clicking on this cell, the user is directed to a new tab (which the user has labelled as Tuesday). My knowledge is somewhat limited. I know I can run a macro and then press <CTRL and the short cut key, but I was hoping to be able to just use the mouse and click on the cell to direct me to the new tab. Any suggestions would be greatly appreciated. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to click a cell with mouse and have a different tab appear
Hi Randy,
Is there any reason you won't to use hyperlink?. "Randy Carriere" <Randy wrote in message ... I was wondering if there is a way where I can click say cell A1 which currently has the text 'Tuesday' in it. By clicking on this cell, the user is directed to a new tab (which the user has labelled as Tuesday). My knowledge is somewhat limited. I know I can run a macro and then press <CTRL and the short cut key, but I was hoping to be able to just use the mouse and click on the cell to direct me to the new tab. Any suggestions would be greatly appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Edit cell by using mouse - right click | Excel Discussion (Misc queries) | |||
Format Cell with Mouse Click | Excel Programming | |||
Opening a URL in a cell without a mouse click | Excel Discussion (Misc queries) | |||
Add cell value with mouse click | Excel Discussion (Misc queries) | |||
get value of a cell with a mouse click | Excel Programming |