ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting a range (https://www.excelbanter.com/excel-programming/331096-selecting-range.html)

djohnson

selecting a range
 
I am having a macro insert data into a worksheet, and need to have it go to
the last populated cell, then copy up 31 cells. I figured out how to find
the last cell, however can't seem to get it to copy the range. I'm new at
this so any help would be appreciated.
Thanks in advance.

cscorp[_12_]

selecting a range
 

Dear Sir

Once you have selected the last cell try this:

Selection.Offset(-30, 0).Resize(31, 1).Copy

What it does?

With the last cell selected move the pointer 30 cells up "Offset
(-30,0)" then expand the selection to cover 31 cells down
"resize(31,1), and copy the selected range. Please, let me know if
that solve your problem.

regards

Juan Carlos


--
cscorp
------------------------------------------------------------------------
cscorp's Profile: http://www.excelforum.com/member.php...o&userid=24015
View this thread: http://www.excelforum.com/showthread...hreadid=376981



All times are GMT +1. The time now is 12:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com