標題:
[發問]
數儲存格顏色數目。
[打印本頁]
作者:
stephenlee
時間:
2020-5-23 16:40
標題:
數儲存格顏色數目。
我要在 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
作者:
微風
時間:
2020-5-23 19:00
Sub test()
Dim sum As Long, Count As Long
sum = 0
Count = 0
For i = 1 To 10
For j = 1 To 10
If Cells(i, j).Interior.ColorIndex = 6 Then
sum = sum + Cells(i, j).Value
Count = Count + 1
End If
Next j
Next i
MsgBox Count & " different Finds"
End Sub
複製代碼
回復
1#
stephenlee
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)