#1
|
|||
|
|||
While loop not working right
I must be crazy because no matter what it stays at good=true
Sub called from userform addcort Code:
Private Sub addcozip_AfterUpdate() 'get zip and call sub to add city and state to textboxes 'this error checking really need to be in the sub addzip Dim good As Boolean 'CHECK TO SEE IS ZIP EXISTS 71889 DOES NOT FOR TESTING good = IsError(Application.Match(addcozip.Value, Range("zipcode").Columns(1), 0)) While good = True If good = True Then 'if zip does not exist get user inout for a good zip addcozip.Value = InputBox("The zip code you entered does not exist. Please enter a valid zip code") Else End If 'CHECK TO SEE IS ZIP EXISTS good = IsError(Application.Match(addcozip.Value, Range("zipcode").Columns(1), 0)) Wend 'call sub to get city and state, addzip is in module GBLSUBS addzip addcozip, ADDcoCT, addcostate End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
'Infinite Loop' error with Infopath 2010 | Debbie25 | Misc | 2 | 05-18-2011 08:38 AM |
Continuous Loop | cksm4 | Word | 6 | 01-06-2011 09:03 PM |
PP 2010 .avi file plays during slide show, but causes the slide show to loop to begin | VictorS | PowerPoint | 0 | 10-16-2010 10:23 AM |
Excel recovery loop problem | fatman57 | Excel | 1 | 09-08-2010 03:57 AM |
Outlook 2003 restart in a loop | Stegel | Outlook | 0 | 06-29-2007 12:34 PM |