Absolute and Relative Macros?

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
i recently asked the same question in another post, and i assume you mean, is there a way to refer to a cell range in a macro so that if the location of that cell range changes, the reference to it in your code also changes automatically. as far as i know, the only way to do this would be to name your cell range in your sheet, then in your macro, use your range name instead of the cell reference to refer to you range.

HTH
kevin
 
Upvote 0
If you record a macro you can choose between absolute and relative - there's a toggle button on the Recorder Toolbar.

In absolute mode the recorder refers to explicit ranges eg Range("A1:A10") (or Sheets or Charts). If you run the macro it does exactly what you did manually.

In relative mode the recorder uses ActiveCell and Offset (or ActiveSheet and ActiveChart). If you run the macro it does what you did manually, but relative to the active cell.

And you can adopt the same approach in non-recorded code.
 
Upvote 0

Forum statistics

Threads
1,218,515
Messages
6,142,916
Members
450,453
Latest member
spaudel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top