請測試看看,謝謝
Sub test()
Dim Arr, Brr(), T$, T1$, n&, R&, i&
Arr = Range("a1").CurrentRegion
ReDim Brr(1 To UBound(Arr), 1 To 3)
T = [L1] & "|" & [M1]
For i = 2 To UBound(Arr)
T1 = Arr(i, 3) & "|" & Arr(i, 2)
If T = T1 Then
n = n + 1: If n = 1 Then R = i
Brr(n, 1) = Application.Text(Arr(i, 4), "00\:00\:00")
Brr(n, 2) = Arr(i, 5): Brr(n, 3) = Arr(i, 6)
End If
Next
If n > 0 Then
[v1].CurrentRegion.Offset(1).ClearContents
Range("n2:p" & UBound(Arr)).ClearContents
Range("n" & R).Resize(n, 3) = Brr
Range("v2").Resize(n, 3) = Brr
End If
End Sub作者: dou10801 時間: 2022-5-5 13:15
Sub 按鈕1_Click()
X = 工作表1.[A65536].End(xlUp).Row
Y = 2
MP1 = Range("L1")
MP2 = Range("M1")
For i = 1 To X
If 工作表1.Cells(i, 3) = MP1 And 工作表1.Cells(i, 2) = MP2 Then
Cells(Y, 14) = Application.Text(工作表1.Cells(i, 4).Value, "00\:00\:00")
Cells(Y, 15).Resize(, 2).Value = 工作表1.Cells(i, 5).Resize(, 2).Value
Y = Y + 1
End If
Next
End Sub
剛在學習,一起研究.作者: hcm19522 時間: 2022-5-5 13:44