folgender Fehler hat sich bei mir eingeschlichen
Ich bekomme die Fehlermeldung:
Fehler beim Kompilieren:
Next ohne For
Ausgegeben. Leider kann ich nicht festellen, wo das Next fehlt.
Sub DokumenteAnlegen()
Dim pre, Projekt As String
pre = ActiveWorkbook.Sheets("Eingabefenster").Cells(4, 2)
Projekt = ActiveWorkbook.Sheets("Eingabefenster").Range("B2").Value
Dim x As Integer
Dim m As Integer
Dim i As Integer
Dim a As Integer
Dim b As Integer
Dim Dokumente As Variant
Dim DokumenteSource As Variant
m = Sheets("Dokumente").Cells(1, 1).End(xlToRight).Column
x = 1
For x = 1 To m
i = Sheets("Dokumente").Cells(1, x).End(xlUp).Row
Dokumente = (Sheets("Dokumente").Cells(2, x).Value)
For i = 1 To x
With Worksheets("Quelle")
a = .Cells(1, x).CurrentRegion.Rows.Count
For b = 1 To a
DokumenteSource = (Sheets("Quelle").Cells(b, x))
Next b
If Dokumente = "" Then Exit For
FileCopy DokumenteSource, Dokumente
Next i
Next x
End Sub
VGDebugger