Absolute References in Excel Macros
Last Updated :
06 Dec, 2023
Excel Macros are incredibly powerful tools that provide the capability to automate repetitive tasks, streamline processes, and save time. When building macros, it's common to use cell references for performing calculations or actions. In some situations, it's important to ensure that these references remain fixed, no matter where the macro is applied or copied. Here the absolute reference plays an important role.
We have two options to refer a cell in Excel VBA Absolute references and Relative references. Default Excel records macro in Absolute mode.
Both absolute references and relative references can be used while recording Excel macros. Regardless of the active cell, a macro recorded using absolute references places the recorded steps exactly in the cells where it was recorded. However, a macro that has been recorded with relative references can carry out the activities at several locations on the worksheet.
In this article, we will learn about absolute references in Excel VBA. We record a macro to type some text in cells B2:B4. Macro always types the text in the cells B2:B4, irrespective of the active cell.
Ensuring Absolute References
We must make sure that the macro is recorded starting from the cell where the steps must begin in order to record a macro with absolute references.
Implementation
Follow the below steps to implement Absolute references in Excel macros:
Step 1: Open Excel and Select Cell “A1”
Note: The macro will place whatever you recorded on the same worksheet in the same location if you do not create a new worksheet before running it. You do not want this. Every report needs to be on a different worksheet.
Recording a Macro
The Record Macro command, located on the ribbon under the VIEW tab Macros, allows you to begin recording the macro.
On the left side of the Excel taskbar, there is a button that says "Start Recording Macro" which you can also use.
Step 2: Go to the “Developer” Tab >> Click “Record Macro”

Give the macro a name that will help others recognize it as a report for a certain project.
Step 3: Enter the Macro name “absolute Reference” and Press “OK”

Your macro begins to record
Step 4: Type “Australia” in cell B2
Step 5: Type “Brazil” in cell B3
Step 6: Type “Mexico” in cell B4
Stop recording the macro
Either use the Stop Recording command located on the ribbon under the VIEW tab Macros or click the Stop Recording Macro button located on the left side of the Excel taskbar to stop recording the macro.
Click on cell B5. This makes sure that the macro always records your steps in B5.
Step 7: Select cell B5 and Press “Stop Recording”

VBA Code (Recorded)
Sub absoluteReference()
Range("B2").Select
ActiveCell.FormulaR1C1 = "Australia"
Range("B3").Select
ActiveCell.FormulaR1C1 = "Brazil"
Range("B4").Select
ActiveCell.FormulaR1C1 = "Mexico"
Range("B5").Select
End Sub
Step 8: We can just delete the contents in cells B2:B4
Step 9: Go to View >> Macros >> View Macros – to pop-up Macro dialogue box [keyboard shortcut - Alt+F8]

Running a Macro
Simply by running the macro, you may create any number of reports in a matter of seconds.
Step 10: On the Ribbon, select the VIEW button and Click Macros
Step 11: Select a Macro from the list (e.g. absolute Reference) and Press “Run”

Output

Importance of Absolute Reference in Excel Macros
Following are some points:
- Consistent Result: By using absolute references, you ensure that your macro consistently performs calculations or actions on specific cells, no matter where it is applied.
- Flexibility in Positioning: With absolute references, you have the flexibility to place your data and formulas in specific locations within the worksheet.
- Enhanced automation: Absolute reference makes your macros more suitable for automated tasks and batch processing.
Similar Reads
Relative References in Excel Macros
We have two options to refer a cell in Excel VBA Absolute references and Relative references. Â Default Excel records macro in Absolute mode. In this article, we learn about Relative references in Excel VBA. Â We select a cell âA1â, turn on âUse Relative Referenceâ and record a macro to type some text
5 min read
Mixed Cell References in MS Excel
Cell: The row and column in Excel together make a cell. We input the value/data(s) in cells of a spreadsheet. There are three types of values that can be entered into the cell. NumbersAlphabeticFormulas Cell reference ââââââis the address or name of a cell or a range of cell is known as Cell referen
3 min read
Mixed Reference in Excel
A cell reference or a cell address is a way to define a cell on a worksheet, it is formed by combining a column letter and a row number. To refer any if the cell on a worksheet (in any formula/ to copy the cell) we use cell reference. Example: To refer to the cell present in row 2 & column D, ce
3 min read
Relative, Absolute and Mixed Cell Reference in Excel
Understanding how cell references in Excel work is a cornerstone of effective spreadsheet use. Whether youâre building formulas that auto-adjust to changes, locking a specific cell, or creating dynamic worksheets, the types of cell referencesârelative, absolute, and mixedâplay a vital role. This gui
11 min read
UserForms in Excel Macros
A UserFrom refers to a form or a dialog box on the screen that enables a user to input data into Excel's user interface. it can be created using the Visual Basic Editor and is used to control data entry and avoid errors. 1. Creating a UserForm: To create a userform head on to the Developer tab->
5 min read
Excel Relative and Absolute Cell References
When working with formulas in Excel, it's crucial to understand the difference between relative and absolute cell references. These two types of cell references behave differently when copied or filled into other cells. Relative cell references change based on their position when a formula is copied
8 min read
How to Record a Macro in Excel
Excel Macro is simply a record button that records a set of actions performed on Excel that can be run multiple times. For example, if you have to format some raw data on a weekly basis you can use a macro to record yourself formatting the data once and let Excel automate the task in the future. it'
11 min read
How to Enable & Run a Macro in Excel? 6 Ways
We can record a macro in Excel or write from scratch in VB Editor. Excel provides different options to run a macro. In this article, we explore four different approaches to running a macro in an Excel application. Even while executing an Excel macro is a straightforward process for seasoned users, i
5 min read
How to Find Circular References in Excel
Circular Reference in Excel is like a loop that keeps going around in circles. It happens when a cell's formula depends on its own result, confusing Excel. In this article, you'll learn how to check, find, enable, or remove Find Circular References in Excel What is a Circular Reference in Excel?A ci
7 min read
How to Configure Macros in Excel
An action or collection of actions can be recorded, named, stored, and executed as many times as necessary and whenever desired using an Excel macro. We can automate repetitive data manipulation and reporting processes that need to be done repeatedly by using macros. You can record a macro and save
4 min read