Sub AwTest()
Dim i&, j%, eRow&, eCol%, n%, y%, c%, arr
eRow = Cells(Rows.Count, "I").End(3).Row
eCol = Cells(2, Columns.Count).End(1).Column
arr = Range([I2], Cells(eRow, eCol))
ReDim brr(1 To UBound(arr) - 1, 1 To 6)
For i = 2 To UBound(arr)
If InStr(arr(i, 1), "Gap") Then
n = 0: y = 0
For j = 2 To UBound(arr, 2)
If arr(i, j) < 0 Then
n = n + 1
If j = UBound(arr, 2) Then GoTo 100:
Else
100:
If n >= 3 Then
y = y + 1: c = 2 * y - 1
If j = UBound(arr, 2) Then
brr(i - 1, c) = Format(arr(1, j - n + 1), "d-mmmm")
Else
brr(i - 1, c) = Format(arr(1, j - n), "d-mmmm")
End If
brr(i - 1, c + 1) = n
End If
n = 0
End If
If y = 3 Then Exit For
Next
End If
Next
[B3].Resize(UBound(brr), 6) = brr
End Sub
没遇到过这种情况!! |