- Sub qs()
- Dim arr, i, j
- m = 0
- With Sheet1
- arr = .Range("a1").CurrentRegion.Value
- ReDim brr(1 To 60000, 1 To 3)
- For i = 2 To UBound(arr)
- If arr(i, 1) > 0 Then
- s = Application.WorksheetFunction.RoundUp(arr(i, 1), -2)
- m = m + 1
- brr(m, 1) = arr(i, 1): brr(m, 2) = s: brr(m, 3) = arr(i, 3)
- End If
- If m = 0 Then
- For j = Val(arr(i, 1)) To Val(arr(i, 2)) Step 100
- m = m + 1
- brr(m, 1) = j
- brr(m, 2) = j + 100
-
- brr(m, 3) = arr(i, 3)
- If brr(m, 2) > Val(arr(i, 2)) Then
- brr(m, 2) = Val(arr(i, 2))
- Exit For
- End If
- Next
- Else
- For j = s To Val(arr(i, 2)) Step 100
- m = m + 1
- brr(m, 1) = j
- brr(m, 2) = j + 100
-
- brr(m, 3) = arr(i, 3)
- If brr(m, 2) > Val(arr(i, 2)) Then
- brr(m, 2) = Val(arr(i, 2))
- Exit For
- End If
- Next
- End If
- Next
- .Range("e2").Resize(m, 3) = brr
- End With
- End Sub
复制代码 |