macro to send you to a specified worksheet

J

Jack Wood

I have a workbook consisting of about 20 tabs. In this workbook I have
a worksheet that is called Index & is an index of all the tabs. On this
index list, need a macro for when the item is selected you will be sent
directly to that sepcific worksheet. Then once at that specific
worksheet I have typed RTN TO INDEX & need a macro on that worksheet
when RTN TO INDEX is selected, will return you to the Index.
 
P

Patrick Molloy

drop a hyperlink on a sheet thats targetting the index sheet . and then just
copy/paste to the other sheets
 
J

Jack Wood

Hyperlinks will not work because to complete items in the workbook you
have to make a copy of the original file & rename it to the Well's
Project name. We do not let the Engineer use the original file for any
entries. When you make a copy of the file the hyperlink sends you back
to the original file.
 
A

andy the pugh

 Then once at that specific
worksheet I have typed RTN TO INDEX & need a macro on that worksheet
when RTN TO INDEX is selected, will return you to the Index.

Perhaps put this code in the ThisWorkbook module?

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
If Target.Value = "RTN TO INDEX" Then
Application.Goto Sheet1.Range("A1"), True
End If
End Sub
 
A

andy the pugh

Perhaps put this code in the ThisWorkbook module?

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
    If Target.Value = "RTN TO INDEX" Then
        Application.Goto Sheet1.Range("A1"), True
    End If
End Sub

Oops, that crashes with a multi-select. Use:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
If Target.Cells(1, 1).Value = "RTN TO INDEX" Then
Application.Goto Sheet1.Range("A1"), True
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top