Sub Mover3()
Dim BkName As String
Dim thisWb As Workbook
Dim wbName As String
Dim prefix As String
prefix = "w19_"
'Imposta il numero di fogli da inserire di default nei nuovi workbooks
With Application
.SheetsInNewWorkbook = 1
End With
'Crea un nuovo wb con nome specificato, nella stessa cartella del wb attivo al momento
Set thisWb = ActiveWorkbook
Workbooks.Add
wbName = "_w19_OVERALL.xlsx"
ActiveWorkbook.SaveAs Filename:=thisWb.Path & "" & wbName
'ActiveWorkbook.Close savechanges:=False
'Nomi dei fogli
ws1 = "1-5"
ws2 = "1-5_tecnico"
ws3 = "6+"
ws4 = "Corporate"
ws5 = "DSL"
ws6 = "VRU"
'Copia dei fogli e spostamento nel file aggregato
'Segmento 1-5
BkName = prefix & ws1 & ".xlsx"
Workbooks(BkName).Sheets("1-5").Copy _
Before:=Workbooks(wbName).Sheets(1)
'Segmento 6+
BkName = prefix & ws3 & ".xlsx"
Windows(BkName).Activate <-- qui mi dà errore!!!!!!!!!!!
'Namesheet = Workbooks(BkName).Sheets("1-5").Name
Workbooks(BkName).Sheets("6+").Copy _
After:=Workbooks(wbName).Sheets(3)
End Sub
|