EXCEL,VBA如何自动筛选

2025-01-06 19:58:30
推荐回答(1个)
回答1:

筛选后求和的公式是
=subtotal(9,b2:b99)
对ab列进行筛选,筛选a列的“a”,并求和的代码如下:
sub
xxx()
activesheet.range("$a$1:$b$999").autofilter
field:=1,
criteria1:="a"
dim
xrng
as
range
set
xrng
=
range("b2:b999")
msgbox
worksheetfunction.subtotal(9,
xrng)
end
sub