返回列表 上一主題 發帖

如何頡取txt檔固定抬頭位置之內容

回復 1# cmo140497


   看不懂 wafer map的繪製邏輯
取得文字檔請參考
  1. Sub nn()
  2. Dim Ar()
  3. fs = Dir(ThisWorkbook.Path & "\*.txt")
  4. Open ThisWorkbook.Path & "\" & fs For Input As #1
  5. Do While Not EOF(1)    ' 執行迴圈直到檔尾為止。
  6.     Line Input #1, Mystr    ' 讀入一行資料並將之指定給變數。
  7.     If Mystr = "SampleDieMap 175" Then y = True
  8.     If Mystr = "InspectionTest 1;" Then y = False
  9.     If y = True Then
  10.     ReDim Preserve Ar(s)
  11.     Ar(s) = Split(Replace(Mystr, ";", ""), " ")
  12.     s = s + 1
  13.     End If
  14. Loop
  15. Close #1
  16. [E1].Resize(s, 2) = Application.Transpose(Application.Transpose(Ar))
  17. End Sub
複製代碼
學海無涯_不恥下問

TOP

回復 3# cmo140497

不知道是不是這個意思?
  1. Sub wafermapping()
  2. fs = ThisWorkbook.Path & "\41M721-2_23_02082011_115952-KLAF.txt"
  3. Open fs For Input As #1
  4. Do While Not EOF(1)    ' 執行迴圈直到檔尾為止。
  5.     Line Input #1, Mystr    ' 讀入一行資料並將之指定給變數。
  6.     If Mystr = "SampleDieMap 175" Then y = True
  7.     If Mystr = "InspectionTest 1;" Then y = False
  8.     Ar = Split(Replace(Mystr, ";", ""), " ")
  9.     If y = True And Asc(Ar(0)) >= 48 And Asc(Ar(0)) <= 57 Then
  10.     Cells(Val(Ar(0)) + 1, Val(Ar(1)) + 1) = "'(" & Ar(0) & "." & Ar(1) & ")"
  11.     End If
  12. Loop
  13. Close #1
  14. End Sub
複製代碼
學海無涯_不恥下問

TOP

回復 5# cmo140497
請說明比對規則,並將欲得到的結果配合說明
學海無涯_不恥下問

TOP

        靜思自在 : 發脾氣是短暫的發瘋。
返回列表 上一主題