Name throwing up address etc...

S

SandTiger

Hiya
I'm trying to devise a way of inputting say a name and then this will
lead to throwing up address details automatically for a form.

Any help appreciated.

Davey
 
B

Bob Phillips

Davey,

Build a table of names and addresses, then lookup VLOOKUP in the help. This
should show you how to retrieve the address, then just populate a textbox
with it. As an example, if name goes in Textbox1, address in TextBox2,3, 4
and the names and addresses are in A1:D10 in Sheet2, then use this event
code

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim sName
On Error GoTo not_found
TextBox2.Text = Application.VLookup(TextBox1.Text,
Worksheets("Sheet2").Range("A1:D10"), 2, False)
TextBox3.Text = Application.VLookup(TextBox1.Text,
Worksheets("Sheet2").Range("A1:D10"), 3, False)
TextBox4.Text = Application.VLookup(TextBox1.Text,
Worksheets("Sheet2").Range("A1:D10"), 4, False)
Exit Sub
not_found:
MsgBox "Problem in lookup", vbExclamation
End Sub
 
S

SandTiger

Thank you and very helpful - I was getting to the point where I
couldn'd see the wood for the trees. We ended up doing it via a short
macro as wasn't quite sure where to place your event code? I'm now
working on a type of text recognition type thing where the program
will recognise what I'm typing and throw up the text when there is
only one option left. For example:

jonathan
jonas

would = 'name' depending on the letter to follow "jona".

Apologies if these are straight forward questions or have been covered
in this group before but Excel is unchartered territory for me :)

Thanks again Bob
 
B

Bob Phillips

Davey,

I think this type of thing would be best done in a textbox as this has a
change event which is fired on every character.

What are the rules for determining what comes next? With a language that has
750,000 (English that is) it seems to me that the number of combinations are
too big for Excel, let alone our code.
 
S

SandTiger

Thanks again Bob, I've seen the predictive text thing done in Access -
I really should be out fishing the Purbecks rather than driving myself
nuts with Excel :)

Which way is the wind blowing?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top