lior03
04-01-2008, 04:50 AM
hello
i weant to search a string across a sheet.if my choice is not found i want to get a chance to search again.i also want another chance if i'm right.
how do i get it.
On Error GoTo ERR_HANDLER
Dim x As String
Dim tryagain As Boolean
tryagain = True
Cells.Select
Do While tryagain = True
x = InputBox("choose value to search...", "searching....")
If Len(x) = 0 Then Exit Sub
selection.Find(What:=x, LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Activate
If MsgBox(ActiveCell.Address, vbExclamation + vbYesNo, x & " - is at: ") = vbYes Then
tryagain = True
End If
Exit Sub
ERR_HANDLER: If MsgBox("String not found !", vbCritical + vbYesNo, "another try?") = vbYes Then
tryagain = True
End If
Loop
thanks
i weant to search a string across a sheet.if my choice is not found i want to get a chance to search again.i also want another chance if i'm right.
how do i get it.
On Error GoTo ERR_HANDLER
Dim x As String
Dim tryagain As Boolean
tryagain = True
Cells.Select
Do While tryagain = True
x = InputBox("choose value to search...", "searching....")
If Len(x) = 0 Then Exit Sub
selection.Find(What:=x, LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Activate
If MsgBox(ActiveCell.Address, vbExclamation + vbYesNo, x & " - is at: ") = vbYes Then
tryagain = True
End If
Exit Sub
ERR_HANDLER: If MsgBox("String not found !", vbCritical + vbYesNo, "another try?") = vbYes Then
tryagain = True
End If
Loop
thanks