|
jiangslly
Sub huizong9()
Dim a, b, r, d, l, m, n, c
Dim arr, arr1, arr2, arr3
r = Sheet1.[a65536].End(xlUp).Row
'arr = Sheet1.Range("a2:b" & r)
With Sheet1
b = Application.WorksheetFunction.CountIf(Range("b2:b" & r), "<2000") - _
Application.WorksheetFunction.CountIf(Range("b2:b" & r), "<1000")
c = Application.WorksheetFunction.CountIf(Sheet1.Range("b2:b" & r), "<3000") - _
Application.WorksheetFunction.CountIf(Sheet1.Range("b2:b" & r), "<2000")
d = Application.WorksheetFunction.CountIf(Sheet1.Range("b2:b" & r), ">3000")
ReDim arr1(1 To b, 1 To 2)
ReDim arr2(1 To c, 1 To 2)
ReDim arr3(1 To d, 1 To 2)
For a = 2 To r
If Cells(a, 2).Value >= 1000 And Cells(a, 2).Value < 2000 Then
m = m + 1
arr1(m, 2) = Cells(a, 2).Value
arr1(m, 1) = Cells(a, 1).Value
End If
If Cells(a, 2).Value >= 2000 And Cells(a, 2).Value < 3000 Then
n = n + 1
arr2(n, 2) = Cells(a, 2).Value
arr2(n, 1) = Cells(a, 1).Value
End If
If Cells(a, 2).Value > 3000 Then
l = l + 1
arr3(l, 2) = Cells(a, 2).Value
arr3(l, 1) = Cells(a, 1).Value
End If
Next
Range("D3").Resize(UBound(arr1), 2) = arr1
Range("F3").Resize(UBound(arr2), 2) = arr2
Range("H3").Resize(UBound(arr3), 2) = arr3
End With
End Sub
|
评分
-
查看全部评分
|