Help Pls re macro cell address

  • Thread starter Thread starter Hugh Jago
  • Start date Start date
H

Hugh Jago

I'm still having a problem with getting my macro to use a variable cell
address.
I'm trying to get the cursor to the cell two rows below my inported data,
and then cut and paste additional calculations. The data will vary in
length each time.

As an example if I start with Data from A2 to A6 then I need to go to A2,
count down, and in cell A8 I want to bring in additional calculations.
The next time I may have data from A2 to A2000, so the additional
calculations
will be pasted into A2002.
If I use the 'shift + ctrl' down arrow, when I enter data it sets the macro
with absolute adress. so the next time I use the macro the calculations are
in the wrong place.
Any ideas please with greatly appreciated.
 
One way:

After importing your data, set a range object variable to the cell two
below the last filled cell:

Dim rDest As Range
Set rDest = Cells(Rows.Count, 1).End(xlUp).Offset(2, 0)

Then copy data to that range:

Sheets("Sheet1").Range("A1:J1").Copy Destination:=rDest
 
Hugh

Selection.Copy Destination:= Sheets("Sheet2").Cells(Rows.Count, 1) _
.End(xlUp).Offset(2, 0)


Gord Dibben Excel MVP
 

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