Ik heb ongeveer 10 tabbladen in mijn bestand die ik 1 voor 1 wil kopieren en als nieuw bestand wil opslaan. Op het tabblad "Invul" geef ik de namen van de tabbladen en de locatie waar de nieuwe bestanden opgeslagen mogen worden. Echter, ik krijg een foutmelding op het moment dat ik een tabblad wil kopieren. Iemand een idee hoe dit op te lossen?
[xml]Sub Maak_bestanden()
Dim ActBook As Workbook
With Sheets("Invul")
.Activate
Locatie = .Cells(7, 2)
LR1 = Cells(Rows.Count, 1).End(xlUp).Row
For X = 10 To LR1
Kopieer_sheet = .Cells(X, 1)
Sheets(Kopieer_sheet).Copy
ActiveWorkbook.SaveAs Filename:=Locatie & "\Invoer " & Kopieer_sheet & ".xlsx"
Set ActBook = ActiveWorkbook
ActBook.Close
Next X
End With
End Sub[/xml]
[xml]Sub Maak_bestanden()
Dim ActBook As Workbook
With Sheets("Invul")
.Activate
Locatie = .Cells(7, 2)
LR1 = Cells(Rows.Count, 1).End(xlUp).Row
For X = 10 To LR1
Kopieer_sheet = .Cells(X, 1)
Sheets(Kopieer_sheet).Copy
ActiveWorkbook.SaveAs Filename:=Locatie & "\Invoer " & Kopieer_sheet & ".xlsx"
Set ActBook = ActiveWorkbook
ActBook.Close
Next X
End With
End Sub[/xml]
Bijlagen
Laatst bewerkt: