Hi there,
Here's an approach which allows you to keep sheetnames out of your code, and uses only a single common routine for all of the sheet selection buttons in the workbook.
The destination sheetnames are entered in the cells immediately to the left of the sheet selection buttons. The same process is used for the "Return To Menu" button on each of the worksheets. The columns which contain the sheet names (C for the Menu worksheet and A for each of the other worksheets) may be hidden if required.
The attached workbook uses the following code:
Option Explicit
Private Sub SelectWorksheet()
Dim rSheetNameCell As Range
Dim sShapeName As String
Dim sSheetName As String
Dim shp As Shape
Dim wks As Worksheet
sShapeName = Application.Caller
Set shp = ActiveSheet.Shapes(sShapeName)
Set rSheetNameCell = shp.TopLeftCell.Offset(0, -1)
sSheetName = rSheetNameCell.Value
Worksheets(sSheetName).Visible = xlSheetVisible
For Each wks In Worksheets
If wks.Name <> sSheetName Then
wks.Visible = xlSheetHidden
End If
Next wks
End Sub
Hope this helps - please let me know how you get on.
Regards,
Greg M
Bookmarks