Excel DDE macro examples
VBA if statements: using control structures to make decisions
Learn how If…Then and Select Case statements let a VBA macro make decisions, for macros used with WinWedge’s more advanced DDE mode.
A control structure is a combination of keywords in code used to make a decision that alters the flow of code the computer executes.
…where condition is some test you want to apply to the conditional structure. If the condition is true, the code within the If and End If statements is executed. If the condition is not true, the code within these statements is skipped over and does not get executed.
…but wouldn’t it be nice if you didn’t have to repeat the test. Fortunately, you have another control structure available to you in VBScript that makes this process easier. The control structure, called If…Then…Else, is represented as
Consider an example in which you want to print a message to the user based on what state the user lives in:
Last modified on November 3, 2026