Move rows from one sheet in a workbook to another workbook

Shathrugan

New Member
Joined
Sep 6, 2018
Messages
1
Hi all,

I have a workbook1 with a single sheet containing multiple rows of data.
I need to create another workbook2 with each sheet consisting one row from workbook1.
To be more clear one row from workbook1 should be contained In one single sheet in workbook2.
If suppose workbook1 has 20 rows of data ,then workbook 2 should have 20 sheets with each row data respectively.Please help in achieving this using macro
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
This macro assumes the sheet in workbook1 containing your data is named "Sheet1" and the data is in column A starting at row 1. The macro can be modified to suit your needs.
Code:
Sub CreateSheet()
    Application.ScreenUpdating = False
    Dim srcWS As Worksheet
    Set srcWS = ThisWorkbook.Sheets("Sheet1")
    Dim LastRow As Long, rng As Range
    LastRow = srcWS.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Workbooks.Add
    For Each rng In srcWS.Range("A1:A" & LastRow)
        Worksheets.Add
        ActiveSheet.Move After:=Worksheets(Worksheets.Count)
        srcWS.Rows(rng.Row).EntireRow.Copy Cells(1, 1)
    Next rng
    Application.ScreenUpdating = True
 End Sub
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

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