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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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.
 
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
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top