Hi There,
I am very new at excel programming, and I'm attempting to create my first userform. I'm trying to see if I can save time on filling out the form by having it autofill if the information already exists on the spreadsheet.
Example: Each person has a unique ID, if I type their user ID into the corresponding userform text box, and that ID already exists on the spreadsheet, I want to autofill their name, address, etc. similar to an online form autofill function. The spreadsheet will continue to grow as I go, therefore I need a dynamic range, referencing all of the information above the new entry as a potential match to the ID.
I'm not sure how to match the user ID, or have it return their corresponding name to the name text box. Here is the code I've got so far:
Thank you in anticipation of your help!
Jarred
I am very new at excel programming, and I'm attempting to create my first userform. I'm trying to see if I can save time on filling out the form by having it autofill if the information already exists on the spreadsheet.
Example: Each person has a unique ID, if I type their user ID into the corresponding userform text box, and that ID already exists on the spreadsheet, I want to autofill their name, address, etc. similar to an online form autofill function. The spreadsheet will continue to grow as I go, therefore I need a dynamic range, referencing all of the information above the new entry as a potential match to the ID.
I'm not sure how to match the user ID, or have it return their corresponding name to the name text box. Here is the code I've got so far:
Code:
Private Sub txtCallerID_AfterUpdate()
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell = txtCallerID.Value
Dim MyRange As Range
Set MyRange = Range(Selection, Selection.End(xlUp))
VL = WorksheetFunction.Match _
(txtCallerID.Value, [MyRange], 0)
If NotFound Then
txtName.Value = ""
Exit Sub
Else
txtName.Value = "Name??"
End If
End Sub
Thank you in anticipation of your help!
Jarred