VBA If <any of these> = <value>? VBA If <any of these> = <value>? vba vba

VBA If <any of these> = <value>?


You can use select case :)

Sub Sample()    Dim variable1, variable2, variable3, variable4, variable5    variable1 = 1: variable2 = 1: variable3 = 1: variable4 = 1: variable5 = 1    Select Case 1        Case variable1, variable2, variable3, variable4, variable5            MsgBox "One of them is equal to 1"        Case Else            MsgBox "none of then is equal to 1"    End SelectEnd Sub