How do I change a macro to use relative cell addresses?

R

Roger D

When I record a macro, it uses absolute cell addresses. How do I change the
macro to run from a specific cell and relative to that cell?
 
D

Don Guillett

try
activecell.offset(1,2)

However, I suspect you are using a lot of SELECTIONS which usually aren't
necessary. Why not copy/paste your code here along with an explanation of
what you are trying to do.
 
B

bornjuice

The only forms I know you can introduce relative references into a
Macro is....

a) using ActiveCell.Offset(R,C), where + is rows below or columns ahead
and - is rows above or columns before. Obviously you had to define R
and C before in the Macro or into the expression as a solid number.

b) sometimes works som others don´t...
Range with the cells method in this way:
Range(Cells(R,C)) or Range(Cells(Ri,Ci),Cells(Re,Ce)), where subscript
"i" referes to initial and "e" refres to end of a range of cells. Same
asumptions about relative references for each one as described before.

Hope it helps...

Alvaro Silva
TMMQ
[email protected]
 
Top