If...Then

If...Then

You can use an If...Then block to execute one or more statements conditionally. You can use either a single-line syntax or a multiple-line “block” syntax:

If condition Then statement

If condition Then
statements
End If

The condition is usually a comparison, but it can be any expression that evaluates to a numeric value. Visual Basic interprets this value as True or False; a zero numeric value is False, and any nonzero numeric value is considered True. If condition is True, Visual Basic executes all the statements following the Then keyword. You can use either single-line or multiple-line syntax to execute just one statement conditionally (these two examples are equivalent):

If anyDate < anydate =" Now

If anyDate <>

anyDate = Now

End If

No comments:

Post a Comment