ich habe einen Datei, die mehrere Tabellenblätter mit dem String "Datum" im Blattnamen enthält.
Ich möchte per VBA alle dies Sheets, welche "Datum" im Namen tragen in eine einzige, neue Datei abspeichern.
Wie löst man so etwas?
Vielen Dank,
Chris
Sub Datum_extra()
Dim TB As Worksheet, WB As Workbook
Dim TMP As Boolean
For Each TB In ThisWorkbook.Sheets
If InStr(TB.Name, "Datum") > 0 Then
If Not TMP Then
TB.Move
Set WB = ActiveWorkbook
TMP = True
Else
TB.Move After:=WB.Sheets(WB.Sheets.Count)
End If
End If
Next
'WB.Saveas ...
End Sub
LG UweD
Sub Baetter_Kopieren()
Dim wb1 As Workbook, wb2 As Workbook
Dim ws As Worksheet
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Add
For Each ws In wb1.Worksheets
If InStr(1, UCase(ws.Name), "DATUM") > 0 Then
ws.Copy after:=wb2.Worksheets(wb2.Worksheets.Count)
End If
Next ws
wb2.Close True, "Neue-Mappe.xlsx"
Set wb1 = Nothing
Set wb2 = Nothing
End Sub
Gruß Worti