- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 120
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2025-5-18
               
|
- Sub Ex()
- Dim ay(9), Ary()
- fs = ThisWorkbook.Path & "\txt.txt"
- Open fs For Input As #1
- Do While Not EOF(1)
- Line Input #1, mystr
- If mystr = "#" Then tn = True: tk = False: GoTo 10
- If tn = True And Not IsNumeric(Split(mystr, " ")(0)) Then ty = Split(mystr, " ")(0): tn = False: GoTo 10
- If mystr = "%" Then tn = False: tk = True: GoTo 10
- If tn = False And tk = True And Val(mystr) <> 0 Then
- ar = Split(mystr, " ")
- ay(0) = ty & ar(0)
- For i = 1 To UBound(ar)
- If ar(i) <> "" Then
- j = j + 1
- ay(j) = ar(i)
- End If
- Next
- ReDim Preserve Ary(s)
- Ary(s) = ay
- s = s + 1: j = 0
- End If
- 10
- Loop
- Close #1
- [A2].Resize(s, 9) = Application.Transpose(Application.Transpose(Ary))
- End Sub
複製代碼 |
|