ich habe eine Arbeitsmappe, mit 152 Tabellenblättern, hier soll mir das Makro als Referenz die Zeile B nehmen und soll dort jeweils die Zeilen welche "irgendwas" enthalten in einen neue Datei kopieren.
Das derzeitige Script, erstellt die neue Datei und Kopiert aus dem aktuell gewählten Tabellenblatt die entsprechenden Zeilen 152 Mal in die neue Datei.
Sub Makro3()
Workbooks.Open Filename:="D:\Users\X\Documents\hilfsdatei.xls"
Windows("Testfallerstellung").Activate
Dim i As Long
Dim laR As Long
Dim lZeile As Long
Dim objWks As Worksheet
Dim nCounter As Integer
Dim nNumWS As Integer
lZeile = 4
Application.ScreenUpdating = False
Windows("Testfallerstellung").Activate
laR = Cells(Rows.Count, 4).End(xlUp).Row
nNumWS = ActiveWorkbook.Worksheets.Count
'MsgBox nNumWS
For nCounter = 1 To nNumWS
Windows("Testfallerstellung").Activate
Set objWks = ActiveWorkbook.Worksheets(nCounter)
MsgBox nCounter
For i = laR To 4 Step -1
If Cells(i, 2).Value "" Then
MsgBox ActiveWorkbook.Name
Windows("Testfallerstellung").Activate
'Set objWks = ActiveWorkbook.Worksheets(nCounter)
Cells(i, 1).EntireRow.Select
Selection.Copy
Windows("hilfsdatei").Activate
Range("A" & lZeile).Select
ActiveSheet.Paste
lZeile = lZeile + 10
'MsgBox ActiveWorkbook.Name
End If
Next i
Set objWks = Nothing
Next nCounter
Application.ScreenUpdating = True
End Sub
mfg Manuel