ABSTRACT

This chapter introduces Visual Basic for Applications' (VBA's) built-in operators that can be used in Excel® VBA code. It also introduces some control structures that can be used to direct the flow of a VBA program. After studying the chapter, readers will be able to use VBA's built-in operators, use the flow control statements, such as If-Then and Select-Case, and to use loops such as For-Next and Do-While. There are four types of operators in VBA: arithmetic operators, string operators, comparison operators and logical operators. The chapter gives a list of VBA's arithmetic operators. The default precedences of the operators are also listed and are applied in the absence of brackets. All the operators are apparent to most people except the modulus operator. The chapter then introduces some methods to control the flow of VBA programs. In particular, it introduces some programming constructs that allow us to skip over some statements.