|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
用VBA编辑窗口,输入代码,
Public Sub Mxbing1984()
R = 1
Y = 2
G = 3
x = Range("A65535").End(xlUp).Row
For i = 1 To x
Cells(i, 1).Select
If Selection.Font.ColorIndex = 3 Then
R = R + 1
End If
If Selection.Font.ColorIndex = 6 Then
Y = Y + 1
End If
If Selection.Font.ColorIndex = 10 Then
G = G + 1
End If
Next
Sheet2.Cells.Clear
Sheet2.Cells(1, 1).Value = "紅色"
Sheet2.Cells(1, 2).Value = R
Sheet2.Cells(2, 1).Value = "黃色"
Sheet2.Cells(2, 2).Value = Y
Sheet2.Cells(3, 1).Value = "綠色"
Sheet2.Cells(3, 2).Value = G
End Sub
|
|