我要在 A欄至J欄中數有顏色的儲存格數目。(只有一款黃色)
當按下按鈕後,便會提示 有多少個數目。
在網上找到以下資料,但是固定了在第二欄,請問如何做到 由A欄至J欄, 找到有顏色的儲存格後,將數目用msgbox 提示出來。謝謝
Sub test()
Dim sum As Long, Count As Long
sum = 0
Count = 0
For i = 1 To 10
If Cells(i, 2).Interior.ColorIndex = 6 Then
sum = sum + Cells(i, 2).Value
Count = Count + 1
End If
Next i
MsgBox Count & " different Finds"
End sub |