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? |
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? |
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 |
All times are GMT +1. The time now is 11:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com