-2
이 코드를 실행할 때 "루프하지 않음"오류가 발생합니다. "case vbno"가 선택되면 원래 입력 상자로 돌아갑니다. 사용자가 "case vbyes"를 선택하면 셀을 강조 표시 한 다음 다시 루프하여 원래의 입력 상자로 돌아갑니다. 취소를 선택하면 완전히 종료하고 싶습니다.Select Case 문 내에서 루프 오류 없음
Sub find_highlight3()
Dim w As Variant
Dim FoundCell As Range
Dim ans As String
Do
w = InputBox("What to find?")
Cells.Find(What:=(w), After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
With Selection.Interior
Select Case MsgBox("Hellow", vbYesNoCancel)
Case vbNo
Loop
Case vbYes
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
Loop
Case vbCancel
End Select
End With
End Sub