Saving Results of VBA Statements

In Chapter 2, while working in the Immediate window, you tried several Visual Basic instructions that returned some information. For example, when you entered ?Cells.Count, you found out that there are 16,777,216 cells in a worksheet. However, when you write Visual Basic procedures outside of the Immediate window, you can't use the question mark. When you omit the question mark and enter Cells.Count in your procedure, Visual Basic won't stop suddenly to tell you the result of this instruction. If you want to know the result after executing a particular instruction, you must tell Visual Basic to memorize it. In programming, results returned by Visual Basic instructions can be written to variables.

0 0

Post a comment