ich habe Werte (Text) in Spalte A bis D stehen. Die möchte ich per Makro wie folgt als xxx.txt ausgeben: [Spalte A];[Apalte B]_[Spalte C]_[Spalte D]
Wie mache ich sowas?
Vielen Dank für Eure Hilfe,
Uwe
Sub Text_File_erstellen()
Dim wks As Worksheet
Dim varFile As Variant
Dim strText As String
Dim Zeile As Long, FF As Integer
varFile = Application.GetSaveAsFilename(InitialFileName:="Text.txt", _
Filefilter:="Textfiles (*.txt), *.txt", _
Title:="Bitte Namen der Textdatei wählen/eingeben")
If varFile = False Then Exit Sub
FF = FreeFile()
Set wks = ActiveSheet
Open varFile For Output As #FF
With wks
For Zeile = 1 To .Cells(.Rows.Count, 1).End(xlUp).Row
strText = "[" & .Cells(Zeile, 1).Text & "];[" _
& .Cells(Zeile, 2).Text & "]_[" _
& .Cells(Zeile, 3).Text & "]_[" _
& .Cells(Zeile, 4).Text & "]"
Print #FF, strText
Next Zeile
End With
Close #FF
Set wks = Nothing
End Sub