#1
|
|||
|
|||
.setfocus not working why?
Code:
Private Sub addcophone_Enter() If IsError(Application.Match(addcozip, Range("zipcode").Columns(1), 0)) Then addcozip.SetFocus 'does not work End If End Sub In the following setfocus is not available at all. Code:
Sub addzip(ByVal zipfield As MSForms.TextBox, ByVal cityfield As MSForms.TextBox, ByVal statefield As MSForms.TextBox) 'carl brehm 05-08-2011 'zip is zipcode entered in field afterupdate 'zipfield is thee name of textbox for the zip code 'cityfield is the name of the textbox for the city 'statefield is the name of the textbox for the state ' zip code Dim zip As Double If zipfield = Empty Then Exit Sub zip = zipfield.Value 'get zipcode entered If IsError(Application.Match(zip, Range("zipcode").Columns(1), 0)) Then zipfield.Value = Empty 'value not found make user reenter cityfield.Value = Empty statefield.Value = Empty MsgBox ("That was not a valid Zip Code") 'STATEFIELD.SETFOCUS NOT AVAIABLE HERE Exit Sub Else 'lookup city and state to prefill textbox cityfield.Value = Application.WorksheetFunction.VLookup(zip, Range("zipcode"), 2, False) statefield.Value = Application.WorksheetFunction.VLookup(zip, Range("zipcode"), 3, False) End If End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Acrobat add-in not working | gdancoleman | Word | 0 | 08-07-2010 06:10 PM |
Can't get AND function working | Scaffold | Excel | 6 | 07-09-2010 01:41 AM |
DocumentBeforePrint not working | maruapo | Drawing and Graphics | 0 | 06-15-2010 12:31 PM |
Spellchecker not working | GR8Fandini | Word | 6 | 02-07-2010 01:12 PM |
working with html | kate1234 | Word | 0 | 09-22-2008 05:02 PM |