Copy Row from work sheet an paste it to another workbook sheetwise

arijitirf

Board Regular
Joined
Aug 11, 2016
Messages
98
Office Version
  1. 2016
Platform
  1. Windows
Hi!
My workbook contains data from A1 to E750. I want to copy data from A1:E1 and paste it to a new workbook Range A1:A5 in Sheet 1. Likewise copy A2:E2 and paste it to that new workbook A1:A5 in Sheet 2.

Help Required.

Thanks in advance.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Does the new workbook already exist or does the macro have to create it? If it already exists, what is its name including the extension? What is the sheet name where the data resides? You understand that what you want to do will create 750 sheets in the new workbook?
 
Last edited:
Upvote 0
Yes, name of the target workbook is Letter.xlsx and name of the source workbook is Data.xlsx. Sheet name will be as Sheet1, Sheet2, Sheet3 ....
 
Upvote 0
Do the 750 sheets already exist in the target workbook and if they do, are they named Sheet1 to Sheet750 sequentially?
 
Last edited:
Upvote 0
Yes. My workbook contains 750 sheets and they are named Sheet1 to the end Sheet750 in ascending order.
 
Upvote 0
Make sure that both workbooks are open. Place the macro below in a standard module in the Data.xlsx workbook and save it as a macro-enabled file so its extension changes to "xlsm". The macro assumes that the sheet containing data from A1 to E750 is named "Sheet1". Change this name in the code to suit your needs.

Code:
Sub CopyRows()
    Application.ScreenUpdating = False
    Dim desWB As Workbook
    Set desWB = Workbooks("Letter.xlsx")
    Dim x As Long
    For x = 1 To 750
        Sheets("Sheet1").Range("A" & x & ":E" & x).Copy desWB.Sheets("Sheet" & x).Cells(1, 1)
    Next x
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks for your reply. But I need this data to be filled between A1:A5 (Transpose)
 
Upvote 0
Try:
Code:
Sub CopyRows()
    Application.ScreenUpdating = False
    Dim desWB As Workbook
    Set desWB = Workbooks("Letter.xlsx")
    Dim x As Long
    For x = 1 To 750
        Sheets("Sheet1").Range("A" & x & ":E" & x).Copy
        desWB.Sheets("Sheet" & x).Cells(1, 1).PasteSpecial Transpose:=True
    Next x
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top