This chapter is from the book
Using the Is Functions
VBA provides a series of functions to help you trap errors that might arise from data type mismatches. These functions test a value to see whether it's a specified type.
- IsArray—Checks whether the value is an array
- IsDate—Checks whether the value is a Date/Time data type
- IsEmpty—Checks whether the value hasn't been initialized with a value
- IsError—Checks whether an expression results in an error
- IsMissing—Checks whether an optional argument has been passed to a procedure
- IsNull—Checks whether the value contains a Null
- IsNumeric—Checks whether the value is a number
- IsObject—Checks whether a variable contains a reference to an object
→ We cover arrays in more detail in Chapter 7, "Working with Arrays."
All these functions use the same syntax, where value is a value or expression being tested:
IsFunction(value)
The functions all return a Boolean data type, either True if the value meets the condition being checked or False if it doesn't.