- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 87
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2025-4-11
               
|
2#
發表於 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
複製代碼 |
|