How to copy data to new template from list after new workbook had been created

mrkdx

New Member
Joined
Feb 14, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello I not sure how to resolve this. I am new to VBA.
I have a template workbook ( named "Template") that I copy multiple times and rename from a list ( name " list " from cell A2 downwards)

the second step which is where I need help ,
is to have the new worksheet template filled with the information from List

B2 downwards from list to A1 on new copied and named template
C2 downwards from list to G1 on new copied and named template
D1 downwards from list to M1 on new copied and named template


Any help would be greatly appreciated.

List
1644899090016.png


Template
1644899301058.png



Below is is the VBA that I have been using to create my new workbook template and rename them from list

Sub SaveMasterAs()

Dim wb As Workbook

Dim rNames As Range, c As Range, r As Range

Set rNames = Worksheets("Sheet1").Range("A2", Worksheets("Sheet1").Range("A2").End(xlDown))

Set wb = Workbooks.Open(ThisWorkbook.Path & "\Template.xlsx")

For Each c In rNames

With wb

.SaveAs Filename:=ThisWorkbook.Path & "\Template Copy\" & c.Value & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

End With

Set wb = ActiveWorkbook

Next c

wb.Close

End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi & welcome to MrExcel.
Does you template workbook only have one sheet?
 
Upvote 0
Ok, how about
VBA Code:
Sub mrkdx()
   Dim wb As Workbook
   Dim rNames As Range, c As Range, r As Range

   With Worksheets("Sheet1")
      Set rNames = .Range("A2", .Range("A" & Rows.count).End(xlUp))
   End With
   Set wb = Workbooks.Open(ThisWorkbook.path & "\Template.xlsx")
   For Each c In rNames
      With wb
         .Sheets(1).Range("A1").Value = c.Offset(, 1).Value
         .Sheets(1).Range("G1").Value = c.Offset(, 2).Value
         .Sheets(1).Range("M1").Value = c.Offset(, 3).Value
         .SaveAs ThisWorkbook.path & "\Template Copy\" & c.Value & ".xlsx", 51
      End With
   Next c
   wb.Close
End Sub
 
Upvote 0
Solution
Ok, how about
VBA Code:
Sub mrkdx()
   Dim wb As Workbook
   Dim rNames As Range, c As Range, r As Range

   With Worksheets("Sheet1")
      Set rNames = .Range("A2", .Range("A" & Rows.count).End(xlUp))
   End With
   Set wb = Workbooks.Open(ThisWorkbook.path & "\Template.xlsx")
   For Each c In rNames
      With wb
         .Sheets(1).Range("A1").Value = c.Offset(, 1).Value
         .Sheets(1).Range("G1").Value = c.Offset(, 2).Value
         .Sheets(1).Range("M1").Value = c.Offset(, 3).Value
         .SaveAs ThisWorkbook.path & "\Template Copy\" & c.Value & ".xlsx", 51
      End With
   Next c
   wb.Close
End Sub
Thank you very much Fluff that worked..
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,400
Messages
6,119,292
Members
448,885
Latest member
LokiSonic

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