Sub 丸丸集計()
'変数宣言
Dim カウント As Long
Dim 日付 As Long
'オートフィルタの始点
With Range("A1")
'日付はA列が今日の日付
.AutoFilter 1, xlFilterToday, xlFilterDynamic
'カテゴリはB列が犬
.AutoFilter 2, "犬"
'可視化されているセルが1個以上の場合
If WorksheetFunction.Subtotal(3, Range("B:B")) > 1 Then
'カウントに数を入れる
カウント = WorksheetFunction.Subtotal(3, Range("B:B"))
End If
.AutoFilter
'転記の処理-----------------------------------------
'日付を開始から終わりまで(A列)
For 日付 = 1 To Cells(Rows.count, 1).End(xlUp).Row
'今日の日付の場合は転記
If Sheet2.Cells(日付, 1) = Date Then
'カウントからマイナス1を引いた数をD列に転記
Sheet2.Cells(日付, 4) = カウント - 1
End If
Next
End With
End Sub