代码更新一下。。。
- Sub ykcbf() '//2024.5.6
- Dim arr, brr
- Application.ScreenUpdating = False
- arr = Sheet3.Range("a1").CurrentRegion
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2) - 1)
- b = [{1,2,3,5,6,7,8,9,10}]
- With Sheets("产能查询")
- .[a4:i10000] = ""
- rq1 = CLng(.[g2])
- rq2 = CLng(.[i2])
- xm = .[b2]
- For i = 2 To UBound(arr)
- rq = CLng(arr(i, 5))
- If rq >= rq1 And rq <= rq2 Then
- If arr(i, 4) = xm Then
- m = m + 1
- brr(m, 1) = m
- For j = 2 To UBound(b)
- brr(m, j) = arr(i, b(j))
- Next
- End If
- End If
- Next
- .Columns(5).NumberFormatLocal = "0"
- If m > 0 Then
- .[a4].Resize(m, UBound(arr, 2) - 1) = brr
- Else
- MsgBox "无相应数据!"
- Exit Sub
- End If
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|