이 코드가 한 달 동안 작동하고 있는데 갑자기 i 행으로 유형 불일치 13이 발생하기 시작합니다. 나는 지금 하루를 찾고 있었고, 관련된 모든 질문은 셀 포맷이나 객체 관련 중 하나이다.명확하게 선언 된 변수에 대한 VBA 유형 불일치 13
나는 내 문제가 여기에 없다고 생각하며 너무 단순 해 보이고 여전히 나를 보지 못하게한다.
내가 뭘하려 : 유형
중고 application.inputbox 방법은 대신 이중의 변형, 정수로했다 변수를 선언 완전히 ommitted 0의 사용은 20 만든 여전히 오류가 발생했습니다. 코드는 0을 입력하거나 변수가 0 인 경우를 제외하고는 작동합니다. 이 코드는 한 달 넘게 작동했습니다. 문제가 무엇입니까?
편집 : 나는에서 InputBox에 숫자가 아닌 문자를 입력 할 때 내가 코드
If farin = a Then farinper(a) = InputBox("more input")
의 다음 줄에 오류 "형식 불일치"를 가지고
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")'If dd = vbNo Then GoTo 789' 그러나 레이블은 실제로'788'입니까? –
아니요 방금 삭제했습니다. ^^ 방금 게시물을 편집했습니다. – user3146025
좋습니다. 질문을 수정하고 코드를 업데이트 할 수 있습니까? –