加总E列筛选后的数字,和放在e列最下面,用VBA怎么写
时间: 2023-05-13 07:06:16 浏览: 115
以下是一个可能的 VBA 代码示例,用于将加总 E 列筛选后的数字放在 E 列最下面:
```
Sub MoveFilteredNumbersToBottom()
Dim lastRow As Long
Dim filteredRange As Range
Dim cell As Range
' Find the last row in column E
lastRow = Cells(Rows.Count, "E").End(xlUp).Row
' Filter column E to show only numbers
Range("E1:E" & lastRow).AutoFilter Field:=1, Criteria1:=">0", Operator:=xlAnd
' Get the filtered range
Set filteredRange = Range("E2:E" & lastRow).SpecialCells(xlCellTypeVisible)
' Move each cell in the filtered range to the bottom of column E
For Each cell In filteredRange
cell.Cut Destination:=Range("E" & lastRow + 1)
lastRow = lastRow + 1
Next cell
' Clear the filter
ActiveSheet.AutoFilterMode = False
End Sub
```
请注意,这只是一个示例代码,可能需要根据您的具体需求进行修改。
阅读全文