請測試看看,謝謝
Sub test()
Dim Arr, Brr, i&, C%
Arr = Range([預約!o1], [預約!a65536].End(3))
Brr = Sheets("說明").[j1].CurrentRegion
Tm = Timer
For i = 2 To UBound(Arr)
If UCase(Arr(i, 15)) = "V" Then
With Sheets("塑板")
.[c17] = Arr(i, 1): .[e22] = Arr(i, 3): .[c28] = Date
For j = 2 To UBound(Brr)
If Arr(i, 2) = Brr(1, j) Then
.[c16] = Brr(2, j): .[c26] = Brr(3, j): .[c27] = Brr(4, j)
End If
Next
End With
C = 1: Exit For
End If
Next
If C = 1 Then
Application.DisplayAlerts = False
Sheets("塑板").Copy
ActiveWorkbook.SaveAs "D:\" & "佳-" & Format(Date, "yyyymmdd") & ".xlsx"
ActiveWindow.Close
Application.DisplayAlerts = True
With Sheets("塑板")
.[c17] = "": .[e22] = "": .[c28] = ""
.[c16] = "": .[c26] = "": .[c27] = ""
End With
End If
MsgBox Timer - Tm
End Sub作者: PJChen 時間: 2021-9-30 01:29