-2
當運行此代碼時,我得到一個錯誤,即「沒有做的循環」。如果選擇「案例vbno」,則需要返回原始輸入框。如果用戶選擇「案例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