Pretty new to VBA (total noob) and struggling hard, I've been cannibalizing bits of formula off various parts of the forum to get what I need and now I'm stuck.
Basically I have a workbook I need said workbook duplicating many times and for it to create the save name from a list here's what I have so far
Sub create()
Dim wb As Workbook, sh1 As Worksheet, lr As Long, rng As Range
Set sh1 = Sheets("List") 'Edit sheet name
Set sh2 = Sheets("Data") 'Edit sheet name
lr = sh1.Cells(Rows.Count, "A").End(xlUp).Row
Set rng = sh1.Range("A1:A" & lr)
For Each c In rng
Sheets("Template").Copy 'Edit sheet name
Set wb = ActiveWorkbook
wb.Sheets(1).Range("A1") = c.Value
sh2.Copy After:=wb.Sheets(1)
wb.SaveAs c.Value & ".xlsx"
wb.Close False
Next
End Sub
So List Is obviously my list of names for the files and it works well, however the workbook has more sheets other than "Data" and "Template" so if I had other sheets named "Data2" and "Data3" for instance how could I write them in to also be copied into the workbooks that are created.
Thank you in advance you wonderful people.
Alex
Set sh3 = Sheets("Data2")then aftersh2.Copy After:=wb.Sheets(1)underneath addsh3.Copy After:=wb.Sheets(1)and do the same for each sheet.