Gruppe
Extern
Problem
Die Texte aus den 3 Tabellenblättern sollen in 3 Textdateien mit den Tabellenblattnamen exportiert werden.
StandardModule: Modul1
Sub TextExport()
Dim rng As Range
Dim iWks As Integer, iRow As Integer, iCol As Integer
Dim sTxt As String, sPath As String
sPath = Application.DefaultFilePath & "\"
For iWks = 1 To Worksheets.Count
Open sPath & Worksheets(iWks).Name & ".txt" For Output As #1
Set rng = Worksheets(iWks).Range("A1").CurrentRegion
For iRow = 1 To rng.Rows.Count
For iCol = 1 To rng.Columns.Count
sTxt = sTxt & Worksheets(iWks).Cells(iRow, iCol).Value & vbTab
Next iCol
Print #1, Left(sTxt, Len(sTxt) - 1)
sTxt = ""
Next iRow
Close #1
Next iWks
MsgBox "Sie finden die Textdateien im Ordner " & Left(sPath, Len(sPath) - 1)
End Sub