Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Marss
 
Posts: n/a
Default Recording a macro ...

How can I use that "Relative Reference" when I'm recording a macro in Excel
2003?
  #2   Report Post  
Gord Dibben
 
Posts: n/a
Default

Just click it on to record relative references rather than hard-coded cell
addresses.

It will record code such as ActiveCell.Offset(5, 0).Select

rather than Range("A8").Select

And if you see the Stop Recording Toolbar but no Relative Reference button,
you can "reset" the Toolbar under ToolsCustomizeToolbars. You may have
dragged the button off.

The usual cause of losing the entire Stop Recording Toolbar is turning it off
when recording by using the "X" to close. Always hit the "stop recording"
button.


Gord Dibben Excel MVP

On Wed, 16 Feb 2005 11:49:05 -0800, "Marss"
wrote:

How can I use that "Relative Reference" when I'm recording a macro in Excel
2003?


  #3   Report Post  
Marss
 
Posts: n/a
Default

Thank you. My problem is that I have a formula and my code looks like

ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)"

with or without "Relative Reference". Is this OK for cells with formulas?
Yes, for cells without formulas the code looks like you told me.

Marss.

"Gord Dibben" wrote:

Just click it on to record relative references rather than hard-coded cell
addresses.

It will record code such as ActiveCell.Offset(5, 0).Select

rather than Range("A8").Select

And if you see the Stop Recording Toolbar but no Relative Reference button,
you can "reset" the Toolbar under ToolsCustomizeToolbars. You may have
dragged the button off.

The usual cause of losing the entire Stop Recording Toolbar is turning it off
when recording by using the "X" to close. Always hit the "stop recording"
button.


Gord Dibben Excel MVP

On Wed, 16 Feb 2005 11:49:05 -0800, "Marss"
wrote:

How can I use that "Relative Reference" when I'm recording a macro in Excel
2003?



  #4   Report Post  
Gord Dibben
 
Posts: n/a
Default

Correct.

That R1C1 code is always relative referenced from the activecell.

Formula references cells 3 rows up to 1 row up from the cell you entered the
formula into.

With RR button on......

ActiveCell.Offset(3, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=R[-14]C[-9]+R[-13]C[-9]"
ActiveCell.Offset(1, 0).Range("A1").Select

With RR button off......

Range("J12").Select
ActiveCell.FormulaR1C1 = "=R[-14]C[-9]+R[-13]C[-9]"
Range("J13").Select

Note the R1C1 reference doesn't change.


Gord

On Wed, 16 Feb 2005 18:47:02 -0800, "Marss"
wrote:

Thank you. My problem is that I have a formula and my code looks like

ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)"

with or without "Relative Reference". Is this OK for cells with formulas?
Yes, for cells without formulas the code looks like you told me.

Marss.

"Gord Dibben" wrote:

Just click it on to record relative references rather than hard-coded cell
addresses.

It will record code such as ActiveCell.Offset(5, 0).Select

rather than Range("A8").Select

And if you see the Stop Recording Toolbar but no Relative Reference button,
you can "reset" the Toolbar under ToolsCustomizeToolbars. You may have
dragged the button off.

The usual cause of losing the entire Stop Recording Toolbar is turning it off
when recording by using the "X" to close. Always hit the "stop recording"
button.


Gord Dibben Excel MVP

On Wed, 16 Feb 2005 11:49:05 -0800, "Marss"
wrote:

How can I use that "Relative Reference" when I'm recording a macro in Excel
2003?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Can't get simple macro to run Abi Excel Worksheet Functions 5 January 12th 05 07:37 PM
Help with macro formula and variable Huge project Excel Worksheet Functions 0 December 28th 04 01:27 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM
Macro Formula revision? Mark Excel Worksheet Functions 1 November 28th 04 01:43 AM


All times are GMT +1. The time now is 02:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"