Sub bb()
Dim Ar, k&, i&, t1, t2, t3, br, x, st, x2, x3, y, r2, r3
Open ThisWorkbook.Path & "\text.txt" For Input As #1
Ar = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbCrLf)
Reset
For i = 3 To UBound(Ar) - 2
t1 = Mid(Ar(i), 1, 43)
t2 = Mid(Ar(i), 44, 16): x2 = Val(Trim(Mid(Ar(i), 14, 15))): r2 = Val(Trim(Mid(Ar(i + 1), 14, 15)))
If i = 3 Then
t2 = 1: x = t2
Else
x3 = Val(Trim(Mid(Ar(i - 1), 29, 15)))
r3 = Val(Trim(Mid(Ar(i), 29, 15)))
If x2 <> x3 Then
x = x + 1
If r2 = r3 Then
y = 1
t2 = x & "(" & y & ")"
Else
y = 0
t2 = x
End If
Else
y = y + 1
t2 = x & "(" & y & ")"
End If
End If
t2 = WorksheetFunction.Rept(" ", 16 - Len(t2) - 1) & t2 & ","
t3 = Mid(Ar(i), 60, Len(Ar(i)) - 59)
Ar(i) = t1 & t2 & t3
Next
st = Join(Ar, vbCrLf): st = Left(st, Len(st) - 2)
Open ThisWorkbook.Path & "\text.txt" For Output As #1
Print #1, st
Reset
End Sub |