Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Navigating among worksheets

I need macro code to do the following: User clicks on a cell in a master
worksheet and is taken to cell A1 in another worksheet. For example:

Click
Cell Worksheet
----- -------------
B14 Atlanta
B15 Philadelphia
B16 Jacksonville
Etc.

There are thirty different click cells on the master worksheet and thirty
different target worksheets.

Thanks, Phil


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Navigating among worksheets

Create hyperlinks in the 'click Cell's.
INSERT / HYPERLINK
Select 'Place in this document' in the box on the left
Select the sheet you want the hyperlink to point to.
Done

HTH,
Gary Brown



"Phil Hageman" wrote:

I need macro code to do the following: User clicks on a cell in a master
worksheet and is taken to cell A1 in another worksheet. For example:

Click
Cell Worksheet
----- -------------
B14 Atlanta
B15 Philadelphia
B16 Jacksonville
Etc.

There are thirty different click cells on the master worksheet and thirty
different target worksheets.

Thanks, Phil


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Navigating among worksheets

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh as Worksheet
if Target.count 1 then exit sub
If Target.Column = 2 Then
If Target.Row =14 and Target.Row <= 43 Then
on Error Resume next
set sh = Worksheets(Target.offset(0,1).Value)
On error goto 0
if not sh is nothing then
sh.Activate
sh.Range("A1").Select
End if
End If
End If
End Sub


--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in message
...
I need macro code to do the following: User clicks on a cell in a master
worksheet and is taken to cell A1 in another worksheet. For example:

Click
Cell Worksheet
----- -------------
B14 Atlanta
B15 Philadelphia
B16 Jacksonville
Etc.

There are thirty different click cells on the master worksheet and thirty
different target worksheets.

Thanks, Phil




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Navigating among worksheets

Tom, Thanks for your reply. For some reason, the macro doesnt work €“ no
error though. I have requested this macro in the early stages of development
of this project, anticipating the need to quickly navigate the user through
all the worksheets. Two things come to mind:
1.) Not all of the target worksheets have been added yet. Additionally, I
may have to add or delete worksheets (cities) as things progress, which would
have their corresponding click cell.
2.) The click cells on the master worksheet (named €śActions€ť) are not
necessarily consecutive, as in the example below.

Click Target
Cell Worksheet
------ ------------
B11 Atlanta
B12 Philadelphia
B14 Jacksonville
B16 Miami
B17 Montgomery
B18 Columbus
B23 Indianapolis

Should the code be looking for the title of the worksheet and then acting on
it?


"Tom Ogilvy" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh as Worksheet
if Target.count 1 then exit sub
If Target.Column = 2 Then
If Target.Row =14 and Target.Row <= 43 Then
on Error Resume next
set sh = Worksheets(Target.offset(0,1).Value)
On error goto 0
if not sh is nothing then
sh.Activate
sh.Range("A1").Select
End if
End If
End If
End Sub


--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in message
...
I need macro code to do the following: User clicks on a cell in a master
worksheet and is taken to cell A1 in another worksheet. For example:

Click
Cell Worksheet
----- -------------
B14 Atlanta
B15 Philadelphia
B16 Jacksonville
Etc.

There are thirty different click cells on the master worksheet and thirty
different target worksheets.

Thanks, Phil





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Navigating among worksheets

Hi, if the user double clicks in the cell you could use something like
this to take them to that sheet (assuming that the sheets are named
after the cities; place this in the sheet module):
Public Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range,
Cancel As Boolean)
Dim C$
Cancel = True
C = Target.Address(False, False)
If C = "B11" Then
Worksheets("Atlanta").Select
ElseIf C = "B12" Then
Worksheets("Philadelphia").Select
ElseIf C = "B14" Then
Worksheets("Jacksonville").Select
ElseIf C = "B16" Then
Worksheets("Miami").Select
ElseIf C = "B17" Then
Worksheets("Montgomery").Select
ElseIf C = "B18" Then
Worksheets("Columbus").Select
ElseIf C = "B23" Then
Worksheets("Indianapolis").Select
End If
End Sub


HTH--Lonnie M.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Navigating among worksheets

Thanks, Lonnie - it works.

"Lonnie M." wrote:

Hi, if the user double clicks in the cell you could use something like
this to take them to that sheet (assuming that the sheets are named
after the cities; place this in the sheet module):
Public Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range,
Cancel As Boolean)
Dim C$
Cancel = True
C = Target.Address(False, False)
If C = "B11" Then
Worksheets("Atlanta").Select
ElseIf C = "B12" Then
Worksheets("Philadelphia").Select
ElseIf C = "B14" Then
Worksheets("Jacksonville").Select
ElseIf C = "B16" Then
Worksheets("Miami").Select
ElseIf C = "B17" Then
Worksheets("Montgomery").Select
ElseIf C = "B18" Then
Worksheets("Columbus").Select
ElseIf C = "B23" Then
Worksheets("Indianapolis").Select
End If
End Sub


HTH--Lonnie M.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Navigating among worksheets

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh as Worksheet
if Target.count 1 then exit sub
If Target.Column = 1 Then
on Error Resume next
set sh = Worksheets(Target.offset(0,1).Value)
On error goto 0
if not sh is nothing then
sh.Activate
sh.Range("A1").Select
End if
End If
End Sub

Misunderstood your post.

It worked a couple of days ago when I responded to your post then and I have
taken out my modifications, so it works now as well.

--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in message
...
Tom, Thanks for your reply. For some reason, the macro doesn't work - no
error though. I have requested this macro in the early stages of

development
of this project, anticipating the need to quickly navigate the user

through
all the worksheets. Two things come to mind:
1.) Not all of the target worksheets have been added yet. Additionally, I
may have to add or delete worksheets (cities) as things progress, which

would
have their corresponding click cell.
2.) The click cells on the master worksheet (named "Actions") are not
necessarily consecutive, as in the example below.

Click Target
Cell Worksheet
------ ------------
B11 Atlanta
B12 Philadelphia
B14 Jacksonville
B16 Miami
B17 Montgomery
B18 Columbus
B23 Indianapolis

Should the code be looking for the title of the worksheet and then acting

on
it?


"Tom Ogilvy" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh as Worksheet
if Target.count 1 then exit sub
If Target.Column = 2 Then
If Target.Row =14 and Target.Row <= 43 Then
on Error Resume next
set sh = Worksheets(Target.offset(0,1).Value)
On error goto 0
if not sh is nothing then
sh.Activate
sh.Range("A1").Select
End if
End If
End If
End Sub


--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in message
...
I need macro code to do the following: User clicks on a cell in a

master
worksheet and is taken to cell A1 in another worksheet. For example:

Click
Cell Worksheet
----- -------------
B14 Atlanta
B15 Philadelphia
B16 Jacksonville
Etc.

There are thirty different click cells on the master worksheet and

thirty
different target worksheets.

Thanks, Phil







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Navigating among worksheets

One more try. Your original post (not today) was clicking in column A and
going to the worksheet in column B. So my macro reflected that. i have now
modified it for clicking on the name of the sheet itself with the assumption
the cell with the name is in column B.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh As Worksheet
If Target.Count 1 Then Exit Sub
If Target.Column = 2 Then
On Error Resume Next
Set sh = Worksheets(Target.Value)
On Error GoTo 0
If Not sh Is Nothing Then
sh.Activate
sh.Range("A1").Select
End If
End If
End Sub

If this doesn't work then I guess I don't understand what you want.

--
Regards,
Tom Ogilvy



"Tom Ogilvy" wrote in message
...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh as Worksheet
if Target.count 1 then exit sub
If Target.Column = 1 Then
on Error Resume next
set sh = Worksheets(Target.offset(0,1).Value)
On error goto 0
if not sh is nothing then
sh.Activate
sh.Range("A1").Select
End if
End If
End Sub

Misunderstood your post.

It worked a couple of days ago when I responded to your post then and I

have
taken out my modifications, so it works now as well.

--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in message
...
Tom, Thanks for your reply. For some reason, the macro doesn't work -

no
error though. I have requested this macro in the early stages of

development
of this project, anticipating the need to quickly navigate the user

through
all the worksheets. Two things come to mind:
1.) Not all of the target worksheets have been added yet. Additionally,

I
may have to add or delete worksheets (cities) as things progress, which

would
have their corresponding click cell.
2.) The click cells on the master worksheet (named "Actions") are not
necessarily consecutive, as in the example below.

Click Target
Cell Worksheet
------ ------------
B11 Atlanta
B12 Philadelphia
B14 Jacksonville
B16 Miami
B17 Montgomery
B18 Columbus
B23 Indianapolis

Should the code be looking for the title of the worksheet and then

acting
on
it?


"Tom Ogilvy" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh as Worksheet
if Target.count 1 then exit sub
If Target.Column = 2 Then
If Target.Row =14 and Target.Row <= 43 Then
on Error Resume next
set sh = Worksheets(Target.offset(0,1).Value)
On error goto 0
if not sh is nothing then
sh.Activate
sh.Range("A1").Select
End if
End If
End If
End Sub


--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in

message
...
I need macro code to do the following: User clicks on a cell in a

master
worksheet and is taken to cell A1 in another worksheet. For

example:

Click
Cell Worksheet
----- -------------
B14 Atlanta
B15 Philadelphia
B16 Jacksonville
Etc.

There are thirty different click cells on the master worksheet and

thirty
different target worksheets.

Thanks, Phil









  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Navigating among worksheets

Tom, This works! When the user clicks a cell, the macro works to find a
worksheet with the same name as the cell clicked on...right? The restriction
in this macro is that the "click" cell must be in the second column...true?
Thanks for taking the time with this.
Phil

"Tom Ogilvy" wrote:

One more try. Your original post (not today) was clicking in column A and
going to the worksheet in column B. So my macro reflected that. i have now
modified it for clicking on the name of the sheet itself with the assumption
the cell with the name is in column B.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh As Worksheet
If Target.Count 1 Then Exit Sub
If Target.Column = 2 Then
On Error Resume Next
Set sh = Worksheets(Target.Value)
On Error GoTo 0
If Not sh Is Nothing Then
sh.Activate
sh.Range("A1").Select
End If
End If
End Sub

If this doesn't work then I guess I don't understand what you want.

--
Regards,
Tom Ogilvy



"Tom Ogilvy" wrote in message
...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh as Worksheet
if Target.count 1 then exit sub
If Target.Column = 1 Then
on Error Resume next
set sh = Worksheets(Target.offset(0,1).Value)
On error goto 0
if not sh is nothing then
sh.Activate
sh.Range("A1").Select
End if
End If
End Sub

Misunderstood your post.

It worked a couple of days ago when I responded to your post then and I

have
taken out my modifications, so it works now as well.

--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in message
...
Tom, Thanks for your reply. For some reason, the macro doesn't work -

no
error though. I have requested this macro in the early stages of

development
of this project, anticipating the need to quickly navigate the user

through
all the worksheets. Two things come to mind:
1.) Not all of the target worksheets have been added yet. Additionally,

I
may have to add or delete worksheets (cities) as things progress, which

would
have their corresponding click cell.
2.) The click cells on the master worksheet (named "Actions") are not
necessarily consecutive, as in the example below.

Click Target
Cell Worksheet
------ ------------
B11 Atlanta
B12 Philadelphia
B14 Jacksonville
B16 Miami
B17 Montgomery
B18 Columbus
B23 Indianapolis

Should the code be looking for the title of the worksheet and then

acting
on
it?


"Tom Ogilvy" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sh as Worksheet
if Target.count 1 then exit sub
If Target.Column = 2 Then
If Target.Row =14 and Target.Row <= 43 Then
on Error Resume next
set sh = Worksheets(Target.offset(0,1).Value)
On error goto 0
if not sh is nothing then
sh.Activate
sh.Range("A1").Select
End if
End If
End If
End Sub


--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in

message
...
I need macro code to do the following: User clicks on a cell in a

master
worksheet and is taken to cell A1 in another worksheet. For

example:

Click
Cell Worksheet
----- -------------
B14 Atlanta
B15 Philadelphia
B16 Jacksonville
Etc.

There are thirty different click cells on the master worksheet and

thirty
different target worksheets.

Thanks, Phil










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
navigating between worksheets Louise Excel Worksheet Functions 3 October 9th 06 05:11 PM
navigating between worksheets Luke Excel Discussion (Misc queries) 1 November 10th 05 01:11 AM
navigating between worksheets exceluserforeman Excel Discussion (Misc queries) 1 November 10th 05 12:36 AM
Navigating between worksheets. shazza Excel Worksheet Functions 1 November 4th 04 12:19 AM
Navigating between worksheets mar Excel Programming 5 October 14th 03 02:21 PM


All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"