rbi
New Member
- Joined
- Oct 3, 2009
- Messages
- 7
I new to VBA and need some direction. I have a workbook with multiple sheets used to configure various products. On each page there's a command button to make a recap page visible, hiding the sheet that called it. What I can not figure out is, when I'm finished with the recap page, how do I then hide it and make the page that called it visible again. Here's my code. It fails to with subscrip out of range on the line marked with . Any help is appreciated as I'm a bit in over my head.
' This is in sheet1 code
Sub ViewSPR_Click()
ViewSPR.TakeFocus******* = False
Run ("PassSheetName") 'Capture activesheet.name & assign to CurrentSheet
Run ("Hidesheets") 'Hides all sheets except Main
Sheets("SPR-Submit").Visible = True
Sheets("Main").Visible = xlVeryHidden
End Sub
________________________________
' Then From Module1 .....
Public Sub PassSheetName()
Dim CurrentSheet As String
CurrentSheet = ActiveSheet.Name
End Sub
_________________________________
'And finally from Sheet7 here's the fail
Private Sub CommandButton1_Click()
Run ("HideSheets")
Sheets(CurrentSheet).Visible = True
Sheets("Main").Visible = xlVeryHidden
End Sub
_________________________________
' This is in sheet1 code
Sub ViewSPR_Click()
ViewSPR.TakeFocus******* = False
Run ("PassSheetName") 'Capture activesheet.name & assign to CurrentSheet
Run ("Hidesheets") 'Hides all sheets except Main
Sheets("SPR-Submit").Visible = True
Sheets("Main").Visible = xlVeryHidden
End Sub
________________________________
' Then From Module1 .....
Public Sub PassSheetName()
Dim CurrentSheet As String
CurrentSheet = ActiveSheet.Name
End Sub
_________________________________
'And finally from Sheet7 here's the fail
Private Sub CommandButton1_Click()
Run ("HideSheets")
Sheets(CurrentSheet).Visible = True
Sheets("Main").Visible = xlVeryHidden
End Sub
_________________________________