ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Arrow right code? (https://www.excelbanter.com/excel-programming/336171-arrow-right-code.html)

Amil

Arrow right code?
 
i am recording macros for an excel solution, however, i noticed that when I
arrow right, excel records an absolute reference (ie. Range("B32").Select) of
the row. This is not good because the number of rows will always be
different. How do I make the selection move to the next cell to the right
without absolute reference?

Jim Thomlinson[_4_]

Arrow right code?
 
activecell.offset(0, 1).select

offsets (moves) the acctive cell 1 column to the right
--
HTH...

Jim Thomlinson


"Amil" wrote:

i am recording macros for an excel solution, however, i noticed that when I
arrow right, excel records an absolute reference (ie. Range("B32").Select) of
the row. This is not good because the number of rows will always be
different. How do I make the selection move to the next cell to the right
without absolute reference?


Tom Ogilvy

Arrow right code?
 
Jim gave you the correct answer, but if you had set your recorder to record
relative, it would have given you this:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 08/02/2005 by OGILVTW
'

'
ActiveCell.Offset(0, 1).Range("A1").Select
End Sub



The relative/absolute toggle button is the right button the the two button
stop recording toolbar.

As you can see, the Range("A1") part is redundant, but is not incorrect.

--
Regards,
Tom Ogilvy


"Amil" wrote in message
...
i am recording macros for an excel solution, however, i noticed that when

I
arrow right, excel records an absolute reference (ie. Range("B32").Select)

of
the row. This is not good because the number of rows will always be
different. How do I make the selection move to the next cell to the right
without absolute reference?




Amil

Arrow right code?
 
The relative/absolute toggle button is the right button the the two button
stop recording toolbar.

I thought that this button opens the VBA IDE, silly me. Thank you.

Amil

Arrow right code?
 
thanks.

"Jim Thomlinson" wrote:

activecell.offset(0, 1).select

offsets (moves) the acctive cell 1 column to the right
--
HTH...

Jim Thomlinson


"Amil" wrote:

i am recording macros for an excel solution, however, i noticed that when I
arrow right, excel records an absolute reference (ie. Range("B32").Select) of
the row. This is not good because the number of rows will always be
different. How do I make the selection move to the next cell to the right
without absolute reference?



All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com