Microsoft Office Tutorials and References
In Depth Information
The Macro Recorder
Figure 7-13: A convenient window arrangement for watching the macro recorder do its thing.
Relative or absolute recording?
When recording your actions, Excel normally records absolute references to cells. In other words,
when you select a cell, it will remember that exact cell (not the cell relative to the current active
cell). To demonstrate how absolute references work, perform these steps and examine the code:
Activate a worksheet and start the macro recorder.
Activate cell B1.
Enter Jan into cell B1.
Move to cell C1 and enter Feb .
Continue this process until you’ve entered the first six months of the year in B1:G1.
Click cell B1 to activate it again.
Stop the macro recorder and examine the new code in the VBE.
Excel generates the following code:
ActiveCell.FormulaR1C1 = “Jan”
ActiveCell.FormulaR1C1 = “Feb”