Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
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. |
#2
![]() |
|||
|
|||
![]()
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 In article , "Hugh Jago" wrote: 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. |
#3
![]() |
|||
|
|||
![]()
Hugh
Selection.Copy Destination:= Sheets("Sheet2").Cells(Rows.Count, 1) _ .End(xlUp).Offset(2, 0) Gord Dibben Excel MVP On Wed, 5 Jan 2005 19:51:54 +0000 (UTC), "Hugh Jago" wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Setting a variable cell address | Excel Discussion (Misc queries) | |||
Concatenate cells without specifying/writing cell address individually | Excel Discussion (Misc queries) | |||
How do I dynamically retrieve the cell address of the last cell t. | Excel Discussion (Misc queries) | |||
Relative Macro Help on Keystrokes | Excel Discussion (Misc queries) | |||
Moving Down a Cell in Macro | Excel Discussion (Misc queries) |