O'Reilly logo

Writing Word Macros, Second Edition by Steven Roman PhD

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

VBA Operators

VBA uses a handful of simple operators and relations, the most common of which are shown in Table 5-5.

Table 5-5. VBA Operators and Relations

Type

Name

Symbol

Arithmetic Operators

Addition

+

 

Subtraction

-

 

Multiplication

*

 

Division

/

 

Division with Integer result

\

 

Exponentiation

^

 

Modulo

Mod

String Operator

Concatenation

&

Logical Operators

AND

And

 

OR

Or

 

NOT

Not

Comparison Relations

Equal

=

 

Less than

<

 

Greater than

>

 

Less than or equal to

<= or =<

 

Greater than or equal to

>= or =>

 

Not equal to

<> or ><

The Mod operator returns the remainder after division. For example:

	8 Mod 3

returns 2, since the remainder after dividing 8 by 3 is 2.

To illustrate string concatenation, the expression:

	"To be or " & "not to be"

is equivalent to:

	"To be or not to be"

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required