range selection address

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

Guest

If I have this code in the Macro

selectionAdd = ActiveWindow.RangeSelection.Addres

Say "selectionAdd" returns cell address "B17", if I want to copy something to "B22", how do I set the variable "selectionAdd" ?? My guess is "selectionAdd +5", but it doesn't work. If "selectionAdd" returns address "C17", copy to "C22"....etc..

If anybody know how to do this, please help me

Thank you

emm
 
Emma,

Try

Range(selectAdd).Offset(5,0).Value = etc.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

emma said:
If I have this code in the Macro:

selectionAdd = ActiveWindow.RangeSelection.Address

Say "selectionAdd" returns cell address "B17", if I want to copy something
to "B22", how do I set the variable "selectionAdd" ?? My guess is
"selectionAdd +5", but it doesn't work. If "selectionAdd" returns address
"C17", copy to "C22"....etc...
 
One way:

Assuming that the cell you want to copy from is the cell referenced by
"rCopy":

rCopy.Copy Range(SelectionAdd).Offset(5, 0)


or, if you just want to copy the values:

Range(selectionAdd).Offset(5, 0).Value = rCopy.Value
 

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