G
Greg Maxey
I have seen a few shortcuts for writing code from reading these groups. Here is an example with select case.
This first bit of code shows an example of how I first learned to use Select Case.
Sub Test()
Dim myString As String
myString = "Red"
Select Case myString
Case Is = "Red"
MsgBox "It's red"
Case Is = "Blue"
MsgBox "It's blue"
Case Else
MsgBox "Not recognized"
End Select
End Sub
I know now that I can shorten that to this:
Sub Test1()
Dim myString As String
myString = "Blue"
Select Case myString
Case "Red": MsgBox "It's red"
Case "Blue": MsgBox "It's blue"
Case Else: MsgBox "Not recognized"
End Select
End Sub
I only know that because I have seen examples here. Where are these little jewels like the ":" documented?
Thanks.
This first bit of code shows an example of how I first learned to use Select Case.
Sub Test()
Dim myString As String
myString = "Red"
Select Case myString
Case Is = "Red"
MsgBox "It's red"
Case Is = "Blue"
MsgBox "It's blue"
Case Else
MsgBox "Not recognized"
End Select
End Sub
I know now that I can shorten that to this:
Sub Test1()
Dim myString As String
myString = "Blue"
Select Case myString
Case "Red": MsgBox "It's red"
Case "Blue": MsgBox "It's blue"
Case Else: MsgBox "Not recognized"
End Select
End Sub
I only know that because I have seen examples here. Where are these little jewels like the ":" documented?
Thanks.