Create new worksheet from list and add data

Prawn

New Member
Joined
Oct 24, 2015
Messages
9
Hi all !

First of all thanks in advance for any help given.

So I have a master worksheet with a list of names in "column A" and data connected to those names in "column B"

I want the names from "column A" made into separate worksheets of the same name.

In column B I have data i would like copied and pasted into cell "A1" of the new worksheets created.

So "A1" from the master would be the name of the new worksheet and "B1" from the master would be pasted into cell "A1" in that new worksheet and so on...
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
VBA Code:
Sub test()
    Dim a, i
    With Sheets("Sheet1")
        a = .Cells(2, 1).Resize(.Cells(Rows.Count, "A").End(xlUp).Row - 1, 2)
        For i = 2 To UBound(a)
            Sheets.Add(After:=Sheets(Sheets.Count)).Name = a(i, 1)
            With ActiveSheet
                .Cells(1, 1) = Application.Index(a, i, 2)
            End With
        Next
    End With
 
Upvote 0
Hi Mohadin

Thanks for your reply but when i try and run this I get a "Compile error expected end sub."
 
Upvote 0
Sorry
VBA Code:
Sub test()
    Dim a, i
    With Sheets("Sheet1")
        a = .Cells(2, 1).Resize(.Cells(Rows.Count, "A").End(xlUp).Row - 1, 2)
        For i = 2 To UBound(a)
            Sheets.Add(After:=Sheets(Sheets.Count)).Name = a(i, 1)
            With ActiveSheet
                .Cells(1, 1) = Application.Index(a, i, 2)
            End With
        Next
    End With
End Sub
 
Upvote 0
Solution
You are a star Mohadin works like a charm.

Thank you so much for your time and help!!
 
Upvote 0
You are very welcome
And thank you for the feedback
Be happy & safe
 
Upvote 0

Forum statistics

Threads
1,214,804
Messages
6,121,652
Members
449,045
Latest member
Marcus05

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