Immediate window

The Immediate window is most useful to execute a single code statement and get the result immediately, without having to create a procedure. You can also call a procedure from the Immediate window. I discuss procedures later in Chapter 3.

 

 

Exercise 1-1: Executing a comparison statement in the Immediate window

Type the following statement, for example, in the Immediate window and press enter to get the immediate result for a logical comparison:

? 2>3

It returns False.

 

Exercise 1-2: Entering a value into a cell from the Immediate window

Type the following statement, for example, in the Immediate window and press enter:

ActiveCell = "Hello"

The statement above enters the word Hello into the active cell in a worksheet of a workbook. At any particular time, only one workbook, one worksheet of the workbook, and one cell in the worksheet can be active. Press Alt-F11 to switch to Excel and see the result in the worksheet.