selecting ranges in copy / paste macro


Posted by Don R. on August 14, 2001 7:23 AM

How do I correct a copy / paste macro when I use the "end" key to select the range. When I record the macro it fixes the copy range based on the size of the range when I recorded the macro (5th line of the macro needs to have a variable - I think).

ActiveCell.Range("A1:B1").Select
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Range("A1:B5").Select
ActiveSheet.Paste



Posted by jimmy on August 14, 2001 7:58 PM


You can reduce this to one line of code :-

Range(ActiveCell, ActiveCell.Offset(0, 1)).Copy Range(ActiveCell.Offset(1, 0), ActiveCell.End(xlDown).Offset(0, 1))