|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 边压数据()
Dim Arr As Variant
Dim fk As Long, h As Long, L As Long, js As Long
fk = Sheets("表1").Cells(Rows.Count, 10).End(xlUp).Row - 7
Arr = Sheets("表1").Range("B8").Resize(fk, 9)
ReDim brr(1 To fk, 1 To 9) As Variant
For h = 1 To fk
If Arr(h, 9) > 3999.9 And Arr(h, 9) < 8000.1 Then '包括4000与8000
' If Arr(h, 9) > 4000 And Arr(h, 9) < 8000 Then '不包括4000与8000
js = js + 1
For L = 1 To 9
brr(js, L) = Arr(h, L)
Next L
End If
Next h
Sheets("表2").UsedRange.Offset(9).Delete Shift:=xlUp
Sheets("表2").UsedRange.Offset(7).ClearContents
Sheets("表2").Range("B9").Resize(js, 9).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove'设置与上方单元格格式相同
Sheets("表2").Range("B8").Resize(js, 9) = brr
Sheets("表2").Range("B7").Resize(fk, 9).Sort key1:=Sheets("表2").Range("J7"), order1:=xlAscending, Header:=xlYes'排序升序
End Sub
工作簿2.rar
(26.99 KB, 下载次数: 2)
|
|