Tom,
Thanks I have finally got it working, it seems that some
of the references I was testing had spaces after them and
some were formated incorrectly.
Now that I've got it working, is there any way I can input
just the last 4 digits of the reference into textbox1
rather than the whole reference.
Thanks
-----Original Message-----
? application.Vlookup("ABC",Range("A1").CurrentRegio n,2,0)
Error 2042
returns an error value if no match is found. You can
test for this
condition
Dim res as Variant
res = application.Vlookup(Textbox1.Text,Range
("A1").CurrentRegion,2,0)
if not iserror(res) then
Textbox2.Text = res
else
Textbox2.Text = "Not found"
End if
--
Regards,
Tom Ogilvy
Adam wrote in
message
...
Tom,
Thanks for the help but all i'm getting is runtime error
13 - type mismatch
Any Ideas what I'm doing wrong?
-----Original Message-----
textbox2.text =
application.Vlookup(Textbox1.Text,Range
("A1").CurrentRegion,2,0)
--
Regards,
Tom Ogilvy
Adam wrote in
message
news:13369732-831D-4F2E-8D97-
...
Ok, i'm a bit of a newbie and teaching myself as I go
along but here is my
problem.
I've got a sheet called data that contain referances
and names and
addresses and looks something like this
REFERENCE NAME
ADDRESS1 ADDRESS2
POSTCODE TELEPHONE
1 10001A FRED 2 THE
STREET THE TOWN
CR0 0123454677
2 10002A BOB 3 OTHER
STREET TOWN2
RH1 0123558745
3 20001C ADAM 4 OTHER
STREET TOWN3
G34 01415745655
4 10003A SUSAN 5 OTHER
PLACE TOWN4
F54 0154555456
ETC....
...
...
1000.......
I want to enter the reference (which is always be
both
numbers and text)
into textbox1 and pull the other cells into textbox2,
3 &
4 etc using
vlookup.
I've tralled through pages of forums but seem to be
getting myself more
confused.
Can someone provide me with the code using vlookup
and
expain it so that I
can use it correctly in future.
thanks.
Adam
.
.