Variables

Tips, Tricks, and Answers

The following articles are available for the 'Variables' topic. Click the article''s title (shown in bold) to see the associated article.

   Converting Numbers to Strings
VBA is great at working with both strings and numbers. At some point you may have a number you need to convert to a string. This is easy enough to do using the Str function, described in this tip.

   Declaring Variables
Declaring variables in a macro is good programming practice. Here's how to do it and how to make sure they are all declared.

   Quickly Clearing Array Contents
An array of variables is a powerful element of VBA programming. If you want to clear what is stored in an array, here's a quick way to do it.

   Swapping Two Numbers
When developing a macro, you may need to swap the values in two variables. It's simple to do using the technique in this tip.

   Swapping Two Strings
Part of developing macros is learning how to use and manipulate variables. This tip examines a technique you can use to exchange the contents of two string variables.

   Understanding Variables
Variables are used quite frequently in programming, and VBA programming is no exception. Each variable can have a data type that defines the characteristics of the data that can be stored in the variable. This tip examines the purpose of variables and the different data types you can use to define them.

This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.