PDA

View Full Version : Select last active cell, offset (-50, 0) copy



Kamakura
08-25-2008, 10:07 AM
Hello,

I would like to create a macro that selects the last active cell in a column, counts back 50 rows, and select all values that fall into that selection. I would then like to copy those values and paste them into another column, let's say location "K2"

Here's what I have so far, and I am stuck.


Range("A1").Select
Range("A1").End(xlDown).Select
ActiveCell.Offset(-50, 0).Range("A1").Select

I really appreciate any help I could get.

Respectfully,

Kirk

Bob Phillips
08-25-2008, 10:17 AM
LastRow = Range("A1").End(xlDown).Row
If LastRow < 50 Then

Set rng = Range("A1").Resize(LastRow)
Else

Set rng = Range("A1").End(xlDown).Offset(-50, 0).Resize(50)
End If
rng.Copy Range("k2")

Kamakura
08-25-2008, 10:28 AM
Thank you so much, you seriously helped me today. I really appreciate it!