Option Explicit
Sub TEST2()
Dim ar, br$(), i&, j&, k&, n&, strJoin$
Application.ScreenUpdating = False
ReDim br(1 To Worksheets.Count)
For i = 1 To Worksheets.Count
With Worksheets(i)
ar = Range(.[A1], .Cells(Rows.Count, "A").End(xlUp)).Value
For k = 1 To UBound(ar)
n = Len(ar(k, 1))
If n Then
If n = 17 Then
If k = UBound(ar) Then
ar(k, 1) = " " & Replace(ar(k, 1), "/", "*") & "*"
Else
ar(k, 1) = " " & Replace(ar(k, 1), "/", "*")
End If
Else
If k = UBound(ar) Then
ar(k, 1) = "-" & ar(k, 1) & "-"
Else
ar(k, 1) = "-" & ar(k, 1)
End If
End If
End If
Next k
For k = 1 To UBound(ar)
br(i) = br(i) & ar(k, 1)
Next k
br(i) = Mid(br(i), 2)
End With
If i <> 1 Then br(i) = vbCrLf & vbCrLf & br(i)
Next i
strJoin = Join(br, "")
Open ThisWorkbook.Path & "\test.txt" For Output As #1
Print #1, strJoin
Close #1
Application.ScreenUpdating = True
Beep
End Sub
|