標題:
取文字檔中,特定字元後之文字
[打印本頁]
作者:
txiec
時間:
2011-12-9 09:46
標題:
取文字檔中,特定字元後之文字
各位大大,,,
再麻煩..有點難,搞不出來.
1. 連續取文字檔中,特定字元後之文字,
2. 取完DATA ,移至其他資料夾
3. 取之前,從最下行,開始置入..
感恩
[attach]8762[/attach]
作者:
Hsieh
時間:
2011-12-9 11:36
回復
1#
txiec
Sub Ex()
Dim ar()
fd = ThisWorkbook.Path & "\"
fs = Dir(fd & "*.txt")
Do Until fs = ""
Open fd & fs For Input As #1
Do Until EOF(1)
Line Input #1, mystr
If mystr <> "" Then
a = Split(mystr, "=")
If a(0) = "SERIAL" Then r = a(1)
If a(0) = "SPEC" Then p = a(1)
If a(0) = "Total QTY" Then t = a(1)
If InStr(a(0), "SUPPLY") > 0 Then y = a(1)
If InStr(a(0), "QTY-") > 0 Then q = a(1)
If r <> "" And p <> "" And t <> "" And y <> "" And q <> "" Then
ReDim Preserve ar(s)
ar(s) = Array(r, p, t, y, q)
s = s + 1
y = "": q = ""
End If
End If
Loop
Close #1
fs = Dir
Loop
[A65536].End(xlUp).Offset(1, 0).Resize(s, 5) = Application.Transpose(Application.Transpose(ar))
End Sub
複製代碼
作者:
txiec
時間:
2011-12-9 14:51
感謝版主...
真的是太讚....
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)