-1

私は、過去 12 か月間に 4 つの合計を取得できるように、1 つの列に 4 つの個別の値を格納し、12 の異なる列の合計を取る必要があるプログラムで作業しています。私が直面している問題は、TYPE MISMATCH エラー 13 が発生し続けることです。

Sub MTBMtotals()

Sheets(8).calculate

meantot = 0
ansitot = 0
apitot = 0
othertot = 0

currmonth = Month("7/22/2013")
curryear = Year("7/22/2013")


Column = currmonth + 2
Row = (curryear - 2012) * 16 + 3

For i = 1 To 12
If Row = 2 Then
Column = 14
Row = Row - 16
End If


meantot = meantotal + Sheets(8).Cells(Row, Column)
ansitot = ansitot + Sheets(8).Cells(Row + 1, Column)
apitot = apitot + Sheets(8).Cells(Row + 2, Column)
othertot = othertot + Sheets(8).Cells(Row + 3, Column)  **<------- Error:13**

Column = Column - 1
Next

Sheets(8).Cells(3, 18) = meantotal
Sheets(8).Cells(4, 18) = ansitot
Sheets(8).Cells(5, 18) = apitot
Sheets(8).Cells(6, 18) = othertot


End Sub

ありがとう、どんな助けも良い助けです。

4

1 に答える 1