OleMiss2010
Member
So in my VBA, Range("B3") will hold the account number that is put into the input box. Range("C5") has a vlookup that will use the account number to lookup information. I want the input box to loop under two conditions: 1) if the input box is blank, or 2) if the vlookup does not find anything to put in Range("C5") for that account number. Under the second condition I want to give the user the option of keeping the account number that they originally typed if it is what they meant to type. This code seems to work as long as the account number is entered correctly the first time. If either condition comes into play then I get a debug message.
Any advice?
[pre]
[/pre]
Any advice?
[pre]
Code:
Do
Acct = Application.InputBox("What is the lead account in the relationship?")
Range("B3").Value = Acct
If IsError(Range("C5").Value) Then
Do
MsgBox "Is this account correct? " & Acct, vbYesNo
If MsgBox("Is this account correct? " & Acct) = vbNo Then
Do
Acct = Application.InputBox("What is the lead account in the relationship?")
Loop While Acct = ""
Else
Range("C5").Values.Errors.Ignore
End If
Loop Until MsgBox("Is this account correct? " & Acct) = vbYes
End If
Loop While Acct = ""