For a solution involving how the heck did I get to this sheet, take
me back take a look at
Return to Previously Selected Sheet
http://www.mvps.org/dmcritchie/excel/sheetback.htm
This will go Back and Forward. If you select a sheet that is
your new forward and you can only go back from there. So I
am not including anything to do with hyperlinks.
Only good for the current workbook and you can't have
another workbook using it. (at least not so far).
The following has been briefly tested and then posted on June 04, 2004.
Updates will be made to website.
'---------- the following into ThisWorkBook
Option Explicit
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
'D.McRitchie, 2004-06-04 sheetback.htm
nxtsheets(0) = nxtsheets(0) + 1
nxtsheets(nxtsheets(0)) = ActiveSheet.Name
End Sub
'--------- the following into a regular module (i.e. module1)
'--------- in your workbook
Option Explicit
Public nxtsheets(100) As Variant
Sub BackBy_nxtsheets()
'D.McRitchie, 2004-06-04 sheetback.htm
If nxtsheets(0) < 2 And nxtsheets(100) = "" Then
MsgBox "can't go back via nxtsheets"
Exit Sub
End If
Worksheets(nxtsheets(nxtsheets(0) - 1)).Activate
nxtsheets(0) = nxtsheets(0) - 2
'-- 1 was subtracted from nxtsheets
End Sub
Sub ForwardBy_nxtsheets()
'D.McRitchie, 2004-06-04 sheetback.htm
If nxtsheets(0) = 100 Then nxtsheets(0) = 0
If nxtsheets(nxtsheets(0) + 1) = "" Then
MsgBox "can't go Forward via nxtsheets"
Exit Sub
End If
Worksheets(nxtsheets(nxtsheets(0) + 1)).Activate
'-- 1 was added to nxtsheets
End Sub
---HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htmSearch Page:
http://www.mvps.org/dmcritchie/excel/search.htm "Andy Brown"