|
おじゃまします。(^^
かみちゃんさんのは下記のようでできそうです。
"=COUNTIF(D3:D" & LastRow & ","">0"") & ""件"""
一応自分のも修正。
Sub test()
Dim rngA As Range
Dim rowA As Long
Dim colA As Long
Dim i As Long
rowA = Range("A65536").End(xlUp).Row
colA = Range("IV2").End(xlToLeft).Column
For i = 4 To colA
Set rngA = Cells(3, i).Resize(rowA - 2)
Cells(rowA + 1, i).Value = Application.CountIf(rngA, ">0") & "件"
Cells(rowA + 2, i).Value = cSum(rngA, 3) & "件" '赤
Cells(rowA + 3, i).Value = cSum(rngA, 6) & "件" '黄
Next i
End Sub
Function cSum(rngA As Range, c As Long) As Long
Dim R As Range
For Each R In rngA
If R.Interior.ColorIndex = c Then
cSum = cSum + 1
End If
Next
End Function
|
|