실제로 뭔가를 시도하고 오류 처리기 작성에 문제가있는 코드를 작성한 것은 처음입니다. 코드는 'tosearch'를 I1 : I10 범위와 일치 시키려고 시도합니다. 일치하는 것이 발견되고 셀이 비어 있으면 사용자 입력을 요구합니다.VBA Excel 오류 처리 불일치 유형 13
분명히 불일치의 가장 작은 스 니프에서 루프가 깨지기 때문에 루프와 일치하는 데 문제가 있습니다. 나는 이것을 해결하기 위해 시도한 '만약 ISERROR (등.)'하지만 난 여전히 불일치 오류 유형 (13)를 얻을 수 디버거는이 라인
If IsError(myvalue = Application.Match(tosearch, Range("i1:i10"), 0)) Then
아래 끔찍한, 거대한 혼란을 무시하십시오 저를 지적한다. 그것은 (그냥) 작동하고 아직 실용적인 사용하지 않지만, 나는 배열 사이의 일치를 신속하게 식별하는 데 사용하고 또한 '올바른'일치가 올바른 정보를 표시하는지 여부에 대한 일부 제어 할 수 있기를 바랍니다.
누구든지 답변을 주시면 도움을 주시면 대단히 감사하겠습니다.
Dim myvalue As String
Dim myrng As Long
Dim tosearch As String
Dim myrnglimit As Long
Dim Uchoose As String
Dim animal As Variant
Dim blankchck As String
myrnglimit = 15
For myrng = 2 To myrnglimit
'isblank check
blankchck = Range("c" & myrng).Value
If blankchck = "" Then
'sets tosearch as each cell
tosearch = Range("a" & myrng).Value
'error checker then it matches each cell to the table hardcoded into the code
If IsError(myvalue = Application.Match(tosearch, Range("i1:i10"), 0)) Then
GoTo nextloop:
Else
myvalue = Application.Match(tosearch, Range("i1:i10"), 0)
'fills in the second column with Animal data
animal = Range("j" & myvalue).Value
Range("a" & myrng).Offset(0, 1).Value = animal
'User input for animal
Uchoose = MsgBox("Excel says : " & Range("k" & myvalue).Value & ". So are " & animal & " good?", vbYesNoCancel, "Status")
If Uchoose = vbYes Then
Range("a" & myrng).Offset(0, 2).Value = "Good"
ElseIf Uchoose = vbNo Then
Range("a" & myrng).Offset(0, 2).Value = "Bad"
ElseIf Uchoose = vbCancel Then
GoTo nextloop:
End If
'Select case to identify 1004 mismatch and skip
nextloop:
'Error checker if
End If
'Avoidblank if
End If
Next myrng
귀하의 질문이 실제로 무엇인지 알 수 없습니까? –
If IsError (Application.Match (tosearch, Range ("i1 : i10"), 0)) Then Then을 사용해야하고 오류가없는 경우 결과를 변수 –
에 씁니다. 오류 덫에 걸린 'myvalue ='에서, 고맙습니다. – user3468246