|
Sub test()
Dim A, B, i, j
Sheets(1).Select
A = Range("A1:AG" & Cells(Rows.Count, 1).End(3).Row)
B = Array(3, 2, 3, 4, 5, 6)
For i = 22 To UBound(A)
For j = 0 To UBound(B)
A(i, UBound(A, 2)) = 0
If A(i, 1) = A(1, B(j)) Then
' Stop
A(i, UBound(A, 2)) = A(i - 1, B(j)): Exit For
End If
Next j
Next i
Sheets(2).Select
Range("A1").Resize(UBound(A), UBound(A, 2)) = A
End Sub
加了这句,就有0。
|
|