Going back to previous worksheet
Firstly capture the name of the sheet you just left and write it away. In
this case to A1 on sheet 1.
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Worksheets("Sheet1").Cells(1, 1) = Sh.Name
End Sub
The for your button use this code
Sub Button2_Click()
Name = Worksheets("Sheet1").Cells(1, 1).Value
Worksheets(Name).Select
End Sub
Mike
"Martin Parker" wrote:
Hi,
I have several worksheets in a workbook, each with a commandbutton which has
the same function (to take the user back to the previously active worksheet).
What I'm trying to achieve is when the user clicks the commandbutton, the
user is taken back to the previously active worksheet i.e. if user is
currently on sheet 3 and was previously working on sheet 2, when the
commandbutton is clicked on sheet 3, the user is automatically transfered to
sheet 2 and so on etc etc.
Can anyone help?
Kind regards
Martin
|