Excel根据字体颜色或背景色求和

2025-03-19 02:27:50

1、 选择【开发工具】 点击【Visual Basic】

Excel根据字体颜色或背景色求和

2、选择【sheet1】,右击,选择【插入】,选择【模块】

Excel根据字体颜色或背景色求和

3、写入代码Function SumByFontColorAndBGColor(Col As Range, SumRange As 伊怕锱鳏Range) '根据字体颜色及背景颜色求和Application.VolatileDim iCell As RangeSumByFontColorAndBGColor = 0For Each iCell In SumRange If iCell.Font.Color = Col.Font.Color And iCell.Interior.Color = Col.Interior.Color Then SumByFontColorAndBGColor = SumByFontColorAndBGColor + Application.WorksheetFunction.Sum(iCell) End IfNextEnd Function

4、1. = SumByFontColorAndBGColor(A3,A1:A12)A3: 根据A3单元格的字体格式和背景色A1:A12:查找的范围。

Excel根据字体颜色或背景色求和
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢