- 帖子
- 10
- 主題
- 3
- 精華
- 0
- 積分
- 15
- 點名
- 0
- 作業系統
- windows7
- 軟體版本
- 2012
- 閱讀權限
- 10
- 註冊時間
- 2015-1-1
- 最後登錄
- 2021-5-26
|
回復 2# p212
謝謝p212的回覆,不過因為資料過多,用函數會跑很久,以巨集執行
巨集也可做到,但目前寫的巨集也是要跑很久
現在巨集如下,是否有簡化時間的寫法? 謝謝!
lastrow_a = Sheets("庫存").Cells(Rows.Count, 1).End(xlUp).Row
lastrow_b = Sheets("查").Cells(Rows.Count, 1).End(xlUp).Row
For ax = 2 To lastrow_b '查工作表的品號列數
For ay = 3 To 12 Step 3 '核取方塊欄
For ao = 2 To lastrow_a '庫存資料庫
If Sheets("查").Cells(ax, ay) = True And Sheets("查").Cells(ax, 1) = Sheets("庫存").Cells(ao, 1) And Sheets("查").Cells(ax, ay + 1) = Sheets("庫存").Cells(ao, 2) Then
Sheets("庫存").Cells(ao, 4)= Sheets("查").Cells(ax, 2)
end if
next
next
next |
|