Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default How do I use R1C1 Reference Style in a Macro?

I would like to write a macro that references the cell 2 rows above the
current cell. I typically use hard references ie Range("D7").Select but that
won't work for this instance. I know that R[-2]C would work but i'm not sure
how to incorporate or call that in a macro. Can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default How do I use R1C1 Reference Style in a Macro?

You probably want to use offset which moves your reference something like
this...

msgbox Activecell.Offest(2,2).Address
or
msgbox Range("A1").offset(2, 2).Address
or
msgbox Cells(5, 5).Offset(2, 2).address
or
msgbox Cells(5, "C").Offset(2, 2).address
--
HTH...

Jim Thomlinson


"Bob" wrote:

I would like to write a macro that references the cell 2 rows above the
current cell. I typically use hard references ie Range("D7").Select but that
won't work for this instance. I know that R[-2]C would work but i'm not sure
how to incorporate or call that in a macro. Can anyone help?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How do I use R1C1 Reference Style in a Macro?

Something like:

activecell.offset(-2,0).select



Bob wrote:

I would like to write a macro that references the cell 2 rows above the
current cell. I typically use hard references ie Range("D7").Select but that
won't work for this instance. I know that R[-2]C would work but i'm not sure
how to incorporate or call that in a macro. Can anyone help?


--

Dave Peterson
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
R1C1 reference style Helpme Please[_2_] Excel Discussion (Misc queries) 5 July 11th 07 11:12 PM
Turn off R1C1 reference style via VBA Mike Milligan Excel Programming 1 October 23rd 06 07:57 PM
can a1 reference style and r1c1 style be used in same formula? rjagga Excel Worksheet Functions 1 September 17th 06 10:58 AM
How to code with the R1C1 Style of Reference? plh Excel Programming 3 April 22nd 06 07:31 PM
R1C1 reference style Peg P Excel Discussion (Misc queries) 2 November 15th 05 06:48 PM


All times are GMT +1. The time now is 10:37 PM.

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

About Us

"It's about Microsoft Excel"