Hello,
I've copied some samples from multiple locations and trying to piece together a workable sample that I can use... I've gotten lost along the way and need some assistance.
What I'm trying to accomplish is having a Template I've created be copied with Values inserted from a table on another page. I had the code to create multiple Workbooks, but I would rather have Worksheets as it would be easier to manage and print all when I've completed the work.
You'll be able to see what I'm trying to do from the code, I've reached a personal impasse on this one and I know you'll be able to solve it; I appreciate your help in advance.
I've copied some samples from multiple locations and trying to piece together a workable sample that I can use... I've gotten lost along the way and need some assistance.
What I'm trying to accomplish is having a Template I've created be copied with Values inserted from a table on another page. I had the code to create multiple Workbooks, but I would rather have Worksheets as it would be easier to manage and print all when I've completed the work.
You'll be able to see what I'm trying to do from the code, I've reached a personal impasse on this one and I know you'll be able to solve it; I appreciate your help in advance.
VBA Code:
Sub create3()
Dim wsIndex As Worksheet, rngIndex As Range, rngData2 As Range, rngData3 As Range, wsData As Worksheet, wsData2 As Worksheet, wsData3 As Worksheet, rngData As Range, i%
Dim wbNew As Worksheet
Set wsIndex = Sheets("Index")
Set rngIndex = wsIndex.Range("c2") 'starting cell for what to paste in g26
Set wsData = Sheets("Index")
Set rngData = wsData.Range("d2") 'starting cell for what to paste in j85
i = 0
Set wsData2 = Sheets("index")
Set rngData2 = wsIndex.Range("f2") 'starting cell for what to paste in j89
i = 0
Set wsData3 = Sheets("index")
Set rngData3 = wsIndex.Range("g2") 'starting cell for what to paste in j93
Do While Not Len(rngIndex.Offset(i, 0)) = 0 'starting at Q16, go down 1 row at a time until you hit an empty cell
Sheets("Template").Copy
Set wbNew = ActiveWorkbook
wsData.Copy After:=wbNew.Sheets(1)
With wbNew.thisworksheet
.Range("g26") = rngIndex.Offset(i, 0) 'starting at ??, you offset 1 additional row at each loop
.Range("j85") = rngData.Offset(i, 0) 'starting at ??, you offset 1 additional row at each loop
.Range("j89") = rngData.Offset(i, 0) 'starting at ??, you offset 1 additional row at each loop
.Range("j93") = rngData.Offset(i, 0) 'starting at ??, you offset 1 additional row at each loop
End With
wbNew.SaveAs rngIndex.Offset(i, 0) & ".xlsx"
wbNew.Close False
i = i + 1
Loop
Set wsIndex = Nothing
Set wsData = Nothing
Set rngIndex = Nothing
Set rngData = Nothing
Set wbNew = Nothing
End Sub