O'Reilly logo

Excel 2013 Formulas by John Walkenbach

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

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.

on_the_web.eps

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”)

To create this function, ...

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