-1
我在工作na程序,我需要在一列中存儲4個單獨的值,並採取12個不同列的總和,以便我可以在過去12個月中總計4個。我遇到的問題是,我不斷收到TYPE MISMATCH erro 13.Excel VBA幫助w /類型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
謝謝,任何幫助是很好的幫助。
您指定的單元格中有什麼? – Stephan
您是否定義了您使用過的變量? – Raystafarian
我打賭它的日期格式 – 2013-07-22 18:23:01