Chapter 25: VBA Programming Concepts
In This Chapter
â¢ Introducing an example Function procedure
â¢ Using comments in your code
â¢ Understanding VBA's language elements, including variables, data types, and constants
â¢ Using assignment expressions in your code
â¢ Declaring arrays and multidimensional arrays
â¢ Using the built-in VBA functions
â¢ Controlling the execution of your Function procedures
â¢ Using ranges in your code
This chapter discusses some of the key language elements and programming concepts in VBA. If you've used other programming languages, much of this information may sound familiar. VBA has a few unique wrinkles, however, so even experienced programmers may find some new information.
This chapter does not even come close to being a comprehensive guide to VBA. Motivated readers can consult the Help system and make use of Internet resources or other books for additional information.
Many of the code examples in this chapter are available at this book's website. The file is named function examples.xlsm.
An Introductory Example Function Procedure
To get the ball rolling, I'll begin with an example Function procedure. This function, named REMOVESPACES, accepts a single argument and returns that argument without any spaces. For example, the following formula uses the REMOVESPACES function and returns ThisIsATest.
=REMOVESPACES(âThis Is A Testâ)