Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, Trying to check if data entered in TextBox1 is a valid entry by looking up a database and returning data into the userform. The "testid' is the first column in the database and is sorted. My code is as follows and I continue to receive the error message even if the data entered in TextBox1 is valid. Can anyone help please. Private Sub TextBox1_AfterUpdate() Sheets("Menu").Select Range("Testid") = TextBox1.Value If Range("Testid").FormulaR1C1 = "=VLOOKUP(TextBox1.Value,TestDB,1,FALSE))" = False Then MsgBox "Test ID does not exist! Either correct the number entered or create a new Database record", vbOK, "Error message" TextBox2.Value = "" TextBox3.Value = "" TextBox4.Value = "" TextBox1.SetFocus Exit Sub Else Range("Number").FormulaR1C1 = "=if(testid="""","""",VLOOKUP(testID,testDB,2,FALS E))" Range("Surname").FormulaR1C1 = "=if(testid="""","""",VLOOKUP(testID,testDB,3,FALS E))" Range("FirstName").FormulaR1C1 = "=If(testid="""","""",VLOOKUP(testID,testDB,4,FALS E))" End If End Sub -- BernzG ------------------------------------------------------------------------ BernzG's Profile: http://www.excelforum.com/member.php...o&userid=22949 View this thread: http://www.excelforum.com/showthread...hreadid=375335 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Validate data but then change the entry to upper case | Excel Worksheet Functions | |||
Code/Function to Look at Previous Entry to Validate Data | Excel Worksheet Functions | |||
How to validate email address during data entry in Excel | Excel Discussion (Misc queries) | |||
Validate in WS to prevent dual data entry | Excel Worksheet Functions | |||
Validate MsgBox Entry to Data in Cells | Excel Discussion (Misc queries) |