ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting & Copying a Changing Range (https://www.excelbanter.com/excel-programming/297066-selecting-copying-changing-range.html)

DNewton[_3_]

Selecting & Copying a Changing Range
 
Hi All,
I have data that I import on a weekly basis that has a variable numbe
of rows, same number of columns that I need a macro to find the end o
the new range, select the whole range and copy it. The data will alway
start in cell A1 and may be from 3 to 10 rows in length, extending t
column K.

Any suggestions?

Thanks,
Don Newto

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Selecting & Copying a Changing Range
 

Set myRange =
Range("A1").Resize(Cells(Rows.Count,"A"),End(xlUp) .Row,numCols)

substitute your value for n umber of columns for numcols

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"DNewton " wrote in message
...
Hi All,
I have data that I import on a weekly basis that has a variable number
of rows, same number of columns that I need a macro to find the end of
the new range, select the whole range and copy it. The data will always
start in cell A1 and may be from 3 to 10 rows in length, extending to
column K.

Any suggestions?

Thanks,
Don Newton


---
Message posted from http://www.ExcelForum.com/




Tom Ogilvy

Selecting & Copying a Changing Range
 
Range("A1").CurrentRegion.Copy Destination:= _
Workbooks("Data").Worksheets("Sheet3").Cells(rows. count,1).End(xlup)(2)

--
Regards,
Tom Ogilvy

"DNewton " wrote in message
...
Hi All,
I have data that I import on a weekly basis that has a variable number
of rows, same number of columns that I need a macro to find the end of
the new range, select the whole range and copy it. The data will always
start in cell A1 and may be from 3 to 10 rows in length, extending to
column K.

Any suggestions?

Thanks,
Don Newton


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 07:36 PM.

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