- 帖子
- 9
- 主題
- 2
- 精華
- 0
- 積分
- 16
- 點名
- 0
- 作業系統
- xp
- 軟體版本
- 2003
- 閱讀權限
- 10
- 性別
- 男
- 註冊時間
- 2011-3-20
- 最後登錄
- 2024-5-28
|
9#
發表於 2011-3-23 05:59
| 只看該作者
本帖最後由 plyl 於 2011-3-23 06:01 編輯
If Sheets("TEST").Cells(myrow, 1) = Sheets("資料檔(材料)").Cells(myrow2, 1) Then
Sheets("資料檔(材料)").Cells(myrow2, 1) 有資料
方法1
Dim myrow, myrow2, myrow3 As Integer
myrow3 = 4
For myrow = 4 To 50
If Sheets("TEST").Cells(myrow, 1) <> "" Then For myrow2 = 3 To 5000
If Sheets("TEST").Cells(myrow, 1) = Sheets("資料檔(材料)").Cells(myrow2, 1) Then
'ITO RECIPE
Sheets("TEST").Cells(myrow3, 41) = Sheets("資料檔(材料)").Cells(myrow2, 32)
'ITES 可RUN 01 OR 02
Sheets("TEST").Cells(myrow3, 64) = Sheets("資料檔(材料)").Cells(myrow2, 33)
myrow3 = myrow3 + 1
End If
Next
End If Next
方法2
Dim myrow, myrow2, myrow3 As Integer
myrow3 = 4
For myrow = 4 To 50
For myrow2 = 3 To 5000
If Sheets("TEST").Cells(myrow, 1) = Sheets("資料檔(材料)").Cells(myrow2, 1) Then
'ITO RECIPE
Sheets("TEST").Cells(myrow3, 41) = Sheets("資料檔(材料)").Cells(myrow2, 32)
'ITES 可RUN 01 OR 02
Sheets("TEST").Cells(myrow3, 64) = Sheets("資料檔(材料)").Cells(myrow2, 33)
myrow3 = myrow3 + 1
If Sheets("TEST").Cells(myrow, 1) = "" Then Exit For
End If
Next
Next
目前測試兩種方法多可以抓到資料
請問方法2的結構是不是錯的
GBKEE版主 辛苦您了!小弟由衷感謝 |
|