我有這個代碼工作一個月了,它突然開始在我標記的行上拋出類型不匹配13。我一直在尋找一天,所有相關的問題都是單元格格式或對象相關的。VBA類型不匹配13上明確申報的變量
我認爲我的問題在這裏既不是,它看起來很簡單,讓我生病,看不到它仍然。
我的嘗試:
型二手application.inputbox法,宣佈說,變量爲整數,變型,而不是雙,完全ommitted 0的使用使其20,仍然得到了錯誤。無論您輸入0還是聲明變量爲零,代碼都可以工作。這段代碼現在工作了一個多月。問題是什麼?
編輯:更多信息
Sub Farincal_OPC_hamyuzde_vs_giriş()
Dim dbs1 As String
Dim dbis1 As String
Dim kayek1 As String
Dim kdn1 As String
Dim ph As Integer
Dim l As Integer
Dim dd As Integer
Dim ctf As Integer
Dim farin As Double
Dim farinper(18) As Double
Dim a As Integer
dd = MsgBox("question?", vbYesNo)
If dd = vbYes Then GoTo 13
If dd = vbNo Then GoTo 789
13
a = 1 'this resets the array
For a = 1 To 18
farinper(a) = 0
Next a
86
farin = InputBox("0 - PREMIX" & vbNewLine & "1 - etc") 'this holds the choice's number on farin
'THE TYPE MISMATCH HAPPENS ON THE LINE BELOW, AS SOON AS IT CHECKS OUT TO BE 0
If farin = 4 Or farin = 5 Then 'this is used for the other choices which i deleted above.
'Code DOES NOT continue the line below, type mismatch happens as soon as the above line is run
a = MsgBox("warning", vbExclamation)
GoTo 86 'PREMİX CHECK!!!!
End If
If farin = 0 Then sheet1.Cells(28, 3) = InputBox("question")
If farin > 18 Or farin < 0 Then
MsgBox ("you are wrong")
GoTo 86
End If
a = 0
For a = 0 To 18
788
If farin = a Then farinper(a) = InputBox("more input")
If farinper(a) < 0 Or farinper(a) > 1 Then
MsgBox ("more error handle")
GoTo 788
End If
Next a
If Application.WorksheetFunction.Sum(farinper) < 1 Then
MsgBox ("info")
GoTo 86
End If
If Application.WorksheetFunction.Sum(farinper) > 1 Then
MsgBox ("error handle")
GoTo 13
End If
sheet1.Cells(27, 3) = farinper(0) ' PREMİX!!
a = 1
For a = 1 To 18
If a = 3 Or a = 4 Then GoTo 9424 'skip unecessary entry
sheet1.Cells(a + 24, 2) = farinper(a)
9424
Next a
是否在'vbNewLine'之後缺少'&'? 'farin = InputBox(「0 - PREMIX」&vbNewLine&「1 - etc」)'你的dd = vbNo Then GoTo 789'但標籤實際上是'788'? – 2014-10-17 07:17:59
不,我只是在刪除^^只是編輯帖子 – user3146025 2014-10-17 07:19:11
好吧,你能編輯你的問題,並更新代碼? – 2014-10-17 07:19:59