Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VLookup
Hi, I'm totally new to VBA, so I do need some help.
Been trying to do a Vlookup function on VBA, but I keep getting Error 1001: Application-defined or object-defined error. Here's my code: Private Sub cmdFinduser_Click() Dim MyRange As Long Dim colNumber As Long MyRange = Sheets("MemberList").Range("B:0").Text txtName.Text = Application.WorksheetFunction.VLookup(txtFOM.Text, MyRange, 4, False) End Sub Thanks for the help |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VLookup
I don't know what txtFOM is, but presuming this is correct, you have a typo
in the range("B:O") you have a zero instead of a O -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS www.nickhodge.co.uk "BigMac" wrote in message ups.com... Hi, I'm totally new to VBA, so I do need some help. Been trying to do a Vlookup function on VBA, but I keep getting Error 1001: Application-defined or object-defined error. Here's my code: Private Sub cmdFinduser_Click() Dim MyRange As Long Dim colNumber As Long MyRange = Sheets("MemberList").Range("B:0").Text txtName.Text = Application.WorksheetFunction.VLookup(txtFOM.Text, MyRange, 4, False) End Sub Thanks for the help |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VLookup
Goodness, foolish me. Thank you so much!
Another thing I realised that I have to set MyRange as Variant, not as Long Cheers! -Mac Nick Hodge wrote: I don't know what txtFOM is, but presuming this is correct, you have a typo in the range("B:O") you have a zero instead of a O -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England HIS www.nickhodge.co.uk "BigMac" wrote in message ups.com... Hi, I'm totally new to VBA, so I do need some help. Been trying to do a Vlookup function on VBA, but I keep getting Error 1001: Application-defined or object-defined error. Here's my code: Private Sub cmdFinduser_Click() Dim MyRange As Long Dim colNumber As Long MyRange = Sheets("MemberList").Range("B:0").Text txtName.Text = Application.WorksheetFunction.VLookup(txtFOM.Text, MyRange, 4, False) End Sub Thanks for the help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
If (Vlookup 0) working, but what if Vlookup cell does not exist | Excel Worksheet Functions | |||
Vlookup in vlookup - taking the result as array name | Excel Worksheet Functions | |||
Which is faster: VLOOKUP-worksheet or VB-array VLOOKUP? | Excel Programming | |||
Vlookup -=VLOOKUP(F9,LookUp1!$A$2:$B$1504,2,FALSE) | New Users to Excel | |||
Vlookup info being used without vlookup table attached? | Excel Worksheet Functions |