Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
I have this code:
I'm almost where I want to be. The thing I'm struggling with, and am here to ask, is how can I name each new sheet to the new workbook according the the names in the array?
for example, copy ThisWorkbook("Master") to new workbook and keep the name, then copy ThisWorkbook("Master") to new workbook and rename it "EVL" and so on until the last sheet is copied and renamed "LSP"
Code:
arrNames = Array("MASTER", "EVL", "EVE", "LWP", "WPL", "WPE", "RPL", "RPE", "HPL", "HPE", "BPL", "BPE", "CUL", "CUE2", "CUE1", "CWP", "CRP", "LSP")
For i = 0 To 17
Set sh = Nothing
On Error Resume Next
Set sh = ThisWorkbook.Sheets("Master")
On Error GoTo 0
If Not sh Is Nothing Then
sh.Copy After:=wb_daily.Sheets(1)
'sheets are hidden
End If
Next i
I'm almost where I want to be. The thing I'm struggling with, and am here to ask, is how can I name each new sheet to the new workbook according the the names in the array?
for example, copy ThisWorkbook("Master") to new workbook and keep the name, then copy ThisWorkbook("Master") to new workbook and rename it "EVL" and so on until the last sheet is copied and renamed "LSP"