Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Conditional-structures/VBA/conditional-structures-1.vba
Normal file
25
Task/Conditional-structures/VBA/conditional-structures-1.vba
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
Sub C_S_If()
|
||||
Dim A$, B$
|
||||
|
||||
A = "Hello"
|
||||
B = "World"
|
||||
'test
|
||||
If A = B Then Debug.Print A & " = " & B
|
||||
'other syntax
|
||||
If A = B Then
|
||||
Debug.Print A & " = " & B
|
||||
Else
|
||||
Debug.Print A & " and " & B & " are differents."
|
||||
End If
|
||||
'other syntax
|
||||
If A = B Then
|
||||
Debug.Print A & " = " & B
|
||||
Else: Debug.Print A & " and " & B & " are differents."
|
||||
End If
|
||||
'other syntax
|
||||
If A = B Then Debug.Print A & " = " & B _
|
||||
Else Debug.Print A & " and " & B & " are differents."
|
||||
'other syntax
|
||||
If A = B Then Debug.Print A & " = " & B Else Debug.Print A & " and " & B & " are differents."
|
||||
If A = B Then Debug.Print A & " = " & B Else: Debug.Print A & " and " & B & " are differents."
|
||||
End Sub
|
||||
16
Task/Conditional-structures/VBA/conditional-structures-2.vba
Normal file
16
Task/Conditional-structures/VBA/conditional-structures-2.vba
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Sub C_S_ElseIf()
|
||||
Dim A$, B$
|
||||
|
||||
A = "Hello"
|
||||
B = "World"
|
||||
'test
|
||||
If A = B Then Debug.Print A & " = " & B
|
||||
'other syntax
|
||||
If A = B Then
|
||||
Debug.Print A & " = " & B
|
||||
ElseIf A > B Then
|
||||
Debug.Print A & " > " & B
|
||||
Else
|
||||
Debug.Print A & " < " & B
|
||||
End If
|
||||
End Sub
|
||||
52
Task/Conditional-structures/VBA/conditional-structures-3.vba
Normal file
52
Task/Conditional-structures/VBA/conditional-structures-3.vba
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
Sub C_S_Select_Case()
|
||||
'With Strings
|
||||
Dim A$, C&
|
||||
|
||||
A = "Hello"
|
||||
Select Case A
|
||||
Case "World"
|
||||
Debug.Print "A = World"
|
||||
Case "Hello"
|
||||
Debug.Print "A = Hello"
|
||||
Case Else
|
||||
Debug.Print "You make a mistake"
|
||||
End Select
|
||||
'With numerics
|
||||
C = 11
|
||||
Select Case C
|
||||
Case Is <= 10
|
||||
Debug.Print "C <= 10"
|
||||
Case Is < 20, Is > 10
|
||||
Debug.Print "10 < C < 20"
|
||||
Case Is >= 20
|
||||
Debug.Print "C >= 20"
|
||||
End Select
|
||||
'Select Case Boolean
|
||||
'With Strings
|
||||
Select Case False
|
||||
Case A <> "Hello"
|
||||
Debug.Print "A = Hello"
|
||||
Case A Like "*orl*"
|
||||
Debug.Print "A Not Like *orl*"
|
||||
Case Else
|
||||
Debug.Print "You make a mistake"
|
||||
End Select 'return : "A = Hello"
|
||||
'Other conditions's order
|
||||
Select Case False
|
||||
Case A Like "*orl*"
|
||||
Debug.Print "A Not Like *orl*"
|
||||
Case A <> "Hello"
|
||||
Debug.Print "A = Hello"
|
||||
Case Else
|
||||
Debug.Print "You make a mistake"
|
||||
End Select 'return : "A Not Like *orl*"
|
||||
'With numerics
|
||||
Select Case True
|
||||
Case C <= 10
|
||||
Debug.Print "C <= 10"
|
||||
Case C < 20, C > 10
|
||||
Debug.Print "10 < C < 20"
|
||||
Case C >= 20
|
||||
Debug.Print "C >= 20"
|
||||
End Select
|
||||
End Sub
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Sub C_S_IIF()
|
||||
Dim myName
|
||||
myName = 2
|
||||
Debug.Print IIf(myName = 1, "Bryan", "Justin")
|
||||
'return : Justin
|
||||
End Sub
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Sub C_S_Switch()
|
||||
Dim myName
|
||||
myName = 2
|
||||
Debug.Print Switch(myName = 1, "Bryan", myName = 2, "Justin", myName = 3, "John")
|
||||
'return : Justin
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue