C
cLiffordiL
All my sheets are being named, and since the names have a chance of
changing regularly, I've thought of storing them in constant variables
inside my Module1. I have many of my macro functions that I need to address
these sheets and their contents. Problem is VBA doesn't seems to let me pass
constant variables through as arguments ("Compile error: ByRef argument type
mismatch"). I've tried declaring ByVal before my arguments (all with blank
values) but the constant values doesn't seems to get passed through in this
case.
Inside Module1:
Const sht001 As String = "MainMenu"
Const sht002 As String = "DynMenu1"
Const sht003 As String = "DynMenu2"
Const sht004 As String = "DynMenu3"
....
Sub SwitchActiveSheet(Original As String, Destination As String)
Sheets(Destination).Visible = True
Sheets(Original).Visible = False
End Sub
Inside Sheet-Level Module of Visual Basic:
' Inside Sheet1
Sub Switch()
Call SwitchActiveSheet(sht001 , sht002)
End Sub
Any help is appreciated. Thanks!
__________
cLiffordiL
changing regularly, I've thought of storing them in constant variables
inside my Module1. I have many of my macro functions that I need to address
these sheets and their contents. Problem is VBA doesn't seems to let me pass
constant variables through as arguments ("Compile error: ByRef argument type
mismatch"). I've tried declaring ByVal before my arguments (all with blank
values) but the constant values doesn't seems to get passed through in this
case.
Inside Module1:
Const sht001 As String = "MainMenu"
Const sht002 As String = "DynMenu1"
Const sht003 As String = "DynMenu2"
Const sht004 As String = "DynMenu3"
....
Sub SwitchActiveSheet(Original As String, Destination As String)
Sheets(Destination).Visible = True
Sheets(Original).Visible = False
End Sub
Inside Sheet-Level Module of Visual Basic:
' Inside Sheet1
Sub Switch()
Call SwitchActiveSheet(sht001 , sht002)
End Sub
Any help is appreciated. Thanks!
__________
cLiffordiL