Add data from list to worksheet based on tab name

EKinATX

New Member
Joined
Sep 30, 2014
Messages
6
Hello,

I have a macro that creates a new sheet from a template and renames these tabs based on a list. The template is called "Template" and the list is in column A of a tab named "List". See code below.

Sub Copy_Sheets()
Dim i As Integer
Dim wks As Worksheet
Dim Last_Row As Long
Set wks = Sheets("List")
Last_Row = wks.Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To Last_Row
Sheets("Template").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = wks.Cells(i, 1)
Next
Calculate
End Sub

I would like to add some additional code, where I copy and paste data from a list into the new sheet.
I have additional data in each row of the "List" sheet in column B, C, and D that corresponds to the sheet name in column A (same row). For example, cells B10, C10, and D10 correspond to it's tab name in A10. I would like to paste this data into specific cells C3, C4, C5, for each sheet.

Thanks for the help!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hello,

does this work as expected?

Code:
Sub Copy_Sheets()
    Dim i As Integer
    Dim wks As Worksheet
    Dim Last_Row As Long
    Set wks = Sheets("List")
    Last_Row = wks.Cells(Rows.Count, 1).End(xlUp).Row
    For i = 1 To Last_Row
        Sheets("Template").Copy After:=Sheets(Sheets.Count)
        ActiveSheet.Name = wks.Cells(i, 1)
        Sheets("List").Range("B" & i & ":D" & i).Copy Range("C3")
    Next
    Calculate
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,626
Members
449,093
Latest member
catterz66

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