Sub
csvExport()
Dim
i
As
Variant
, j
As
Variant
Dim
Ze
As
Long
, Sp
As
Long
Dim
FF
As
Integer
Dim
FullPath1
As
String
Dim
lRow
As
Long
Dim
Zeile
As
String
, Zelle
As
String
Dim
sh
As
Worksheet
For
Each
sh
In
ActiveWorkbook.Worksheets
sh.Activate
i = 0
j = 0
i = sh.Cells(Rows.Count, 5).
End
(xlUp).Row
j = sh.Cells(Rows.Count, 6).
End
(xlUp).Row
If
i > j
Then
lRow = i
Else
lRow = j
End
If
FullPath1 =
"C:\Users\Foena\Desktop\csv\" & ActiveSheet.Name & "
.txt"
FF = FreeFile
Open FullPath1
For
Output
As
#FF
For
Ze = 2
To
lRow
If
sh.Cells(Ze, 5) <>
""
Or
sh.Cells(Ze, 6) <>
""
Then
Zeile =
""
For
Sp = 5
To
6
Zelle = sh.Cells(Ze, Sp)
If
IsNumeric(Trim(Zelle))
Then
Zelle = Trim(Zelle) &
";"
Zelle = Replace(Zelle,
","
,
"."
)
Else
Zelle =
";"
End
If
Zeile = Zeile & Zelle
Next
Sp
If
Zeile =
";;"
Then
Zeile =
""
If
Zeile <>
""
Then
Print #1, Zeile
End
If
Next
Ze
Close #FF
Next
sh
End
Sub