Sub sumColor()Dim mycell As Rangen = 0For Each mycell In Range("A1:B10")If mycell.Interior.Color = vbRed Thenn = n + mycell.ValueEnd IfNext mycellMsgBox (n)End Sub上面最后得出的n,就是红色单元格的和。