|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- With Worksheets("初一分班原始成绩")
- tj = .Range("f2:o4")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a7:j" & r)
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
- m = 0
- For i = 1 To UBound(arr)
- If arr(i, 4) <> tj(1, 4) Then
- For j = 6 To UBound(arr, 2)
- If Abs(arr(i, j) - tj(1, j)) > tj(3, j) Then
- Exit For
- End If
- Next
- If j > UBound(arr, 2) Then
- m = m + 1
- For j = 1 To UBound(arr, 2)
- brr(m, j) = arr(i, j)
- Next
- End If
- End If
- Next
- If m = 0 Then
- MsgBox "没有符合条件数据!"
- Exit Sub
- End If
- .Range("r4:aa" & .Rows.Count).ClearContents
- .Range("r4").Resize(m, UBound(brr, 2)) = brr
- MsgBox "共查到" & m & "条符合条件数据!"
- End With
-
- End Sub
复制代码 |
|