ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using VBA to copy range of cells (https://www.excelbanter.com/excel-programming/337526-using-vba-copy-range-cells.html)

JTF

Using VBA to copy range of cells
 
HI all

I need to copy and paste a range of cells from one worksheet to
another. The first cell to be copied will always be A3. The last cell
will vary depending on how many rows of data are entered. The last
entry, however will always be in column S - only the row will vary.

I've tried a number of things, to no avail...can anyone help? Thanks.


[email protected]

Using VBA to copy range of cells
 
I've monkeyed with this, too... got the solution by recording what I
would do on the sheet to make this happen...

This should work for you

Range("A3:S3").Select
Range(Selection, Selection.End(xlDown)).Select

Note: This will only work when the data in column A is continuous to
the end of the series (i.e., there are no blank cells between A3 and
the last cell in column A with data).

Hope that helps!


JTF

Using VBA to copy range of cells
 
It does the job very nicely. Thanks!!!!!


Rob

Using VBA to copy range of cells
 
If your data's not continuous but you are going to the last row in a column
you could use this to copy the range:

range(cells(3,1),cells(65536,19).end(xlup)).copy

Rob

" wrote:

I've monkeyed with this, too... got the solution by recording what I
would do on the sheet to make this happen...

This should work for you

Range("A3:S3").Select
Range(Selection, Selection.End(xlDown)).Select

Note: This will only work when the data in column A is continuous to
the end of the series (i.e., there are no blank cells between A3 and
the last cell in column A with data).

Hope that helps!




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

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