简体   繁体   中英

Excel : Copy and paste multiple rows and columns from one worksheet to another

i would like to copy multiple rows from one worksheet to another , i have data starting in one worksheet at A2 row and ends at A108850 and it starts at A2 column and ends at I2 column , how can i copy all that data into another worksheet where row starts with A4 and column starts with A4 and ends with I4.

How could i possibly do it through some macro?.

Thanks.

Try this

Worksheets("Sheet1").Range("A2:I108850").Copy Worksheets("Sheet2").Range("A4")

Change the range reference and worksheet's name accordingly.

Copy&Paste is an "expensive" operation, the greater the range the more expensive the operation

Should you be interested in values only, you could try this:

    Worksheets("DestinationSheetName").Range("A2:I108850").Value = Worksheets("SourceSheetName").Range("A2:I108850").Value

edited after OP's comment

Should the code in your last comment have the same aim of pasting values only, then change the second statement into the following:

    With Worksheets("Sheet1").Range("A2:I108850") '<--| reference the "source" range you want to paste values from
         .Range("A4").Resize(.Rows.Count, .Columns.Count).Value = .Value '<--| resize "destination" range accordingly to "source" one and paste values into it
    End With

of course you must check for sheet names to be valid ones for the currently active workbook

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM