筛选后求和的公式是=subtotal(9,b2:b99)对ab列进行筛选,筛选a列的“a”,并求和的代码如下:subxxx()activesheet.range("$a$1:$b$999").autofilterfield:=1,criteria1:="a"dimxrngasrangesetxrng=range("b2:b999")msgboxworksheetfunction.subtotal(9,xrng)endsub