Sub AAA()
Sheet1.[J6:P65536].ClearContents
X = Sheet1.[A65536].End(xlUp).Row
Y = Sheet1.[J65536].End(xlUp).Row
For M = 2 To X
If Sheet1.Cells(M, 5) = Sheet1.Cells(2, 10) Or Sheet1.Cells(M, 5) = Sheet1.Cells(2, 11) Or Sheet1.Cells(M, 6) = Sheet1.Cells(2, 12) Or Sheet1.Cells(M, 6) = Sheet1.Cells(2, 13) Then
Sheet1.Cells(Y + 1, 10).Resize(, 7).Value = Sheet1.Cells(M, 1).Resize(, 7).Value
Y = Y + 1
End If
Next
End Sub作者: q1a2z5 時間: 2020-3-19 08:28
Sub AAA()
Sheet1.[J665536].ClearContents
X = Sheet1.[A65536].End(xlUp).Row
Y = Sheet1.[J65536].End(xlUp).Row
For M = 2 To X
If Sheet1.Cells(M, 5) = Sheet1.Cells(2, 10) Or Sheet1.Cells(M, 5) = Sheet1.Cells(2, 11) Or Sheet1.Cells(M, 6) = Sheet1.Cells(2, 12) Or Sheet1.Cells(M, 6) = Sheet1.Cells(2, 13) Then
Sheet1.Cells(Y + 1, 10).Resize(, 7).Value = Sheet1.Cells(M, 1).Resize(, 7).Value
Y = Y + 1
End If
Next
End Sub作者: q1a2z5 時間: 2020-3-19 08:55
Sub AAA()
Sheet1.[J665536].ClearContents
X = Sheet1.[A65536].End(xlUp).Row
Y = Sheet1.[J65536].End(xlUp).Row
For M = 2 To X
If Sheet1.Cells(M, 5) = Sheet1.Cells(2, 10) Or Sheet1.Cells(M, 5) = Sheet1.Cells(2, 11) Or Sheet1.Cells(M, 6) = Sheet1.Cells(2, 12) Or Sheet1.Cells(M, 6) = Sheet1.Cells(2, 13) Then
Sheet1.Cells(Y + 1, 10).Resize(, 7).Value = Sheet1.Cells(M, 1).Resize(, 7).Value
Y = Y + 1
End If
Next
End Sub作者: hcm19522 時間: 2020-3-19 09:53
Option Explicit
Sub TEST()
Dim Brr, V, i&, j%, T$, R&
T = "/" & [J2] & "/" & [K2] & "/" & [L2] & "/" & [M2] & "/"
Brr = Range([G1], [A65536].End(xlUp))
For i = 2 To UBound(Brr)
V = InStr(T, "/" & Brr(i, 5) & "/") + InStr(T, "/" & Brr(i, 6) & "/")
If V > 0 Then R = R + 1: For j = 1 To 7: Brr(R, j) = Brr(i, j): Next
Next
[J6].Resize(R, 7) = Brr
Erase Brr
End Sub