Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Another option is to drop the .worksheetfunction:
Private Sub FindButton_Click() Dim x As Range, y As Range Dim cb As String dim Res as variant Set x = Worksheets("Table").Range("B2") Set y = Worksheets("Table").Range("B65536").End(xlUp).Offs et(0, 7) cb = Box1.Value res = Application.VLookup(cb, Range(x, y), 2, False) if iserror(res) then box2.value = "missing!" else box2.value = res end if End Sub VB Newbie wrote: Good day to all! I am trying to import data into my simple 2-field userform using a lookup function. In the first field, I enter my criteria. Then I click the "Find" button to look this up in a range. However, the data doesn't come into that field and I get an error msg saying runtime error 424, object required. Here is what I have: Private Sub FindButton_Click() Dim x As Range, y As Range Dim cb As String Set x = Worksheets("Table").Range("B2") Set y = Worksheets("Table").Range("B65536").End(xlUp).Offs et(0, 7) cb = Box1.Value Application.WorksheetFunction.VLookup(cb, Range(x, y), 2, False).Select = _ Box2.Value End Sub Thank you for your assistance!! -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA: Pull Record Into UserForm | Excel Programming | |||
VBA: Pull Record Into UserForm | Excel Programming | |||
VBA: Pull Record Into UserForm | Excel Programming | |||
VBA: Pull Record Into UserForm | Excel Programming | |||
pull down menu on userform | Excel Programming |