|
かみちゃん さん 最後に一つだけお願いします。
算出した数字の横に「件」を添えるにはどうすればよいでしょうか
Sub Macro1()
Dim LastRow As Long, RowNo As Long
Dim LastColumn As Integer, ColumnNo As Integer
Dim lngSum03 As Long, lngSum06 As Long
Dim c As Range
LastRow = Range("A65536").End(xlUp).Row
LastColumn = Range("IV2").End(xlToLeft).Column
Range(Cells(LastRow + 1, 4), Cells(LastRow + 1, LastColumn)).Formula _
= "=COUNTIF(D3:D" & LastRow & ","">0"")"
For ColumnNo = 4 To LastColumn
lngSum03 = 0
lngSum06 = 0
For RowNo = 3 To LastRow
With Cells(RowNo, ColumnNo)
Select Case .Interior.ColorIndex
Case 3 '赤
lngSum03 = lngSum03 + .count
Case 6 '黄
lngSum06 = lngSum06 + .count
End Select
End With
Next
Cells(LastRow + 2, ColumnNo).Value = lngSum03 & "件"
Cells(LastRow + 3, ColumnNo).Value = lngSum06 & "件"
Next
End Sub
|
|