検索条件
全1件
(1/1ページ)
' 収入専用 Function 科目別収入集計(科目) Dim rowsData As Long '行数カウント用の変数 rowsData = Worksheets("現金出納帳").Cells(Rows.Count, 1).End(xlUp).Row '最後の行数を取得 'Debug.Print rowsData Dim total As Long Dim i As Long For i = 5 To rowsData If Worksheets("現金出納帳").Cells(i, 3).Value = 科目 Then lineVal = Worksheets("現金出納帳").Cells(i, 5).Value 'Debug.Print Worksheets("現金出納帳").Cells(i, 5).Value total = total + lineVal End If Next i 'Debug.Print total 科目別収入集計 = total End Function ' 支出専用 Function 科目別支出集計(科目) Dim rowsData As Long rowsData = Worksheets("現金出納帳").Cells(Rows.Count, 1).End(xlUp).Row Dim total As Long Dim i As Long For i = 5 To rowsData If Worksheets("現金出納帳").Cells(i, 3).Value = 科目 Then lineVal = Worksheets("現金出納帳").Cells(i, 6).Value total = total + lineVal End If Next i 科目別支出集計 = total End Function
=科目別収入集計("雑収入")
=科目別支出集計("雑費")