Howdy y'all:
I'm using a userForm to allow the user to select a driver and then I want to come up with the selected Driver's ID from a listing. From within the spreadsheet, the vLookup works fine but I keep getting Error 1004 when I try to run it from within the userForm. The driverName part is working fine. Any ideas?
TIA.
Bob
Here's the code:
Private Sub CommandButton1_Click() Dim driverName As String driverName = Me.lbSelectDriver.Value MsgBox driverName MsgBox Application.WorksheetFunction.VLookup(driverName, "lookupData!ba1:bb250", 2) Unload Me End Sub
Last edited by bstubbs; 07-15-2009 at 11:21 AM.
Hi
Assuming that bal is a single cell defined name then try
ryloMsgBox Application.WorksheetFunction.VLookup(driverName, sheets("lookupData").range("ba1:bb250"), 2)
Thank you - worked like a champ!
Hi I need help. I am a beginner in VBA. I have created my user form and now I want to program the OK button to fill the form. I have a combobox where user selects the line. I also have these lines on a column in a spread sheet. For instance I can have L01 like 3 times , then say L02 like 5 times.
I have the list of all the lines as a combo. I want my userform to lookup the line selected by the user and then check if the offset (0,1) is empty and then fill out the information.
I will be grateful if you can help
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks