软件: excel
版本: 2007、2010
前几天在网络上搜寻统计储存格颜色的相关资料时,
看到知识+有人分享一个VBA的语法
Function CountColor(标准格 As Range, 范围 As Range)
Dim 单元格, 颜色, 数量
Application.Volatile
For Each 单元格 In 范围
If 单元格.Interior.ColorIndex = 标准格.Interior.ColorIndex Then
数量 = 数量 + 1
End If
Next 单元格
CountColor = 数量
End Function
来源:
![]()
用在OS为中文的系统里没有问题,可以正常使用
但是用在OS为日文的电脑里却出现乱码@@
想把上述VBA语法里的中文字改成英文
但却找不到该用哪些英文字取代XD
不知道有没有人可以帮帮忙 ~~
自行回答XD
google了一些用语,实际改改看之后就成功了XD
附上改好的~
Function CountColor(StandardCells As Range, Rng As Range)
Dim rCells, Color, Count
Application.Volatile
For Each rCells In Rng
If rCells.Interior.ColorIndex = StandardCells.Interior.ColorIndex Then
Count = Count + 1
End If
Next rCells
CountColor = Count
End Function