Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/select-case-statement

https://superuser.com/questions/1458990/pass-case-argument-to-sub-vba/1458997#1458997

Main Sub:

Public Sub Test()

Call CaseTest("Case2") ' Note the ""

End Sub

"Called Sub":

Public Sub CaseTest(CaseSelect)

Select Case CaseSelect

Case "Case1"

MsgBox "Case1"

Case "Case2" ' Note the ""

MsgBox "Case2"

End Select
End Sub

Main Sub:

Public Sub Test()

Call CaseTest(2)

End Sub

"Called Sub":

Public Sub CaseTest(CaseSelect)

Select Case CaseSelect

Case 1

MsgBox "Case1"

Case 2

MsgBox "Case2"

End Select
End Sub
  • No labels