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:
1.
Activate a worksheet and start the macro recorder.
2.
Activate cell B1.
3.
Enter Jan into cell B1.
4.
Move to cell C1 and enter Feb .
5.
Continue this process until you’ve entered the first six months of the year in B1:G1.
6.
Click cell B1 to activate it again.
7.
Stop the macro recorder and examine the new code in the VBE.
Excel generates the following code:
Sub Macro1()
Range(“B1”).Select
ActiveCell.FormulaR1C1 = “Jan”
Range(“C1”).Select
ActiveCell.FormulaR1C1 = “Feb”
Range(“D1”).Select
 
Search JabSto ::




Custom Search