|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
用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
|
|