redspanna
Well-known Member
- Joined
- Jul 27, 2005
- Messages
- 1,592
- Office Version
- 365
- Platform
- Windows
Hi all
I have this code that copies a 'Template' worksheet x number of times into a new Workbook
Can anybody help to change the code so that the newly created workbook is automatically named Monthly Report plus the text string found in source workbook, info sheet Range G2.
So if the source workbook, Info Sheet cell G2 holds Dec-15 the newly created workbook will be named Monthly Report Dec-15
many thanks
I have this code that copies a 'Template' worksheet x number of times into a new Workbook
Code:
Dim wb As Workbook, sh1 As Worksheet
Set sh1 = ThisWorkbook.Sheets("Info")
ThisWorkbook.Sheets("Template").Copy
Set wb = ActiveWorkbook
For i = 2 To 32
Set sh2 = wb.Sheets(i - 1)
sh2.Name = sh1.Range("O" & i).Value
sh2.Range("F4") = sh1.Range("K" & i).Value
sh2.Range("E31") = sh1.Range("L" & i).Value
sh2.Range("J31") = sh1.Range("L" & i).Value
If wb.Sheets.Count < 31 Then
ThisWorkbook.Sheets("Template").Copy After:=wb.Sheets(wb.Sheets.Count)
End If
Next
Can anybody help to change the code so that the newly created workbook is automatically named Monthly Report plus the text string found in source workbook, info sheet Range G2.
So if the source workbook, Info Sheet cell G2 holds Dec-15 the newly created workbook will be named Monthly Report Dec-15
many thanks