das unten aufgeführte VBA funktioniert perfekt - nur möchte ich im neuen Arbeitsblatt gerne die Formeln übernehmen und nicht nur die Werte aus der Ursprungsdatei:
Sub export()
s = GetDirectory("Bitte wählen Sie einen Ordner")
If s = "" Then
MsgBox "abgebrochen!"
Exit Sub
Else
Dim rng As Range
Dim col As New Collection
Dim iRow As Integer
Dim sFile As String
Application.ScreenUpdating = False
ActiveSheet.Columns("A:A").Hidden = False
iRow = 2
sFile = s
On Error Resume Next
Do Until IsEmpty(Cells(iRow, 2))
col.Add Cells(iRow, 2).Value, Cells(iRow, 2).Value
iRow = iRow + 1
Loop
On Error GoTo 0
Application.DisplayAlerts = False
For iRow = 1 To col.Count
Range("A1").CurrentRegion.AutoFilter field:=2, Criteria1:=col(iRow)
Set rng = Range("A1").CurrentRegion.SpecialCells(xlCellTypeVisible)
Workbooks.Add
rng.Copy Range("A1")
ActiveWorkbook.SaveAs sFile & "\" & col(iRow) & ".xlsx"
ActiveSheet.Columns("A:A").Hidden = True
ActiveWorkbook.Close savechanges:=True
Next iRow
Application.DisplayAlerts = True
Application.ScreenUpdating = True
ActiveSheet.AutoFilterMode = False
MsgBox "fertig!"
End If
End Sub
Danke!!