Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

extract data from listbox on userform

Posted on 2014-07-28
5
878 Views
Last Modified: 2014-07-29
Hi: I have an excel 2007 worksheet, comprising jobs in progress.  On the form I have a userform with a list box. THe listbox lists the job numbers and names . I want to be able to select a job from the list and by doing so populate a series of textboxes  on the form with other  data for that job, drawn from the worksheet. For example select job 123 and the cost for that job fills textbox1, date fills textbox2, etc. A bit like HLOOKUP for a userform! . I have read about offset but this does not seem to do the 'job'. Does anybody know how to set up the form to read in the data?
Thanks!
0
Comment
Question by:ClaytonGlass
  • 4
5 Comments
 

Author Comment

by:ClaytonGlass
ID: 40226105
Hi: just to follow up I attach a mockup of the worksheet. Hope it helps!
userformlistbox.xlsm
0
 
LVL 33

Accepted Solution

by:
Rob Henson earned 300 total points
ID: 40226483
You can link your input and text boxes on the user form to cells on a worksheet. By doing so you can set the value of the input to a cell and then have other cells with lookups as suggested pulling the other required data. These cells are then referred to by the boxes on the User Form and should update as the input changes.

With the input box you will have to set a small piece of VBA to populate the relevant cell and maybe force calculation if it is switched off.

Thanks
Rob h
0
 

Author Comment

by:ClaytonGlass
ID: 40226530
Aaahhhhh... you mean use the list box to populate a spare cell on the worksheet (say at the very bottom). THen using actual hloookup formula on worksheet to populate adjacent cells on the spreadsheet from that selection. Then the userform picks up the contents of the adjacent lookup cells.
 So data loops from worksheet to userform, back to worksheet, then back to userform? Sounds like a plan!
Let me give it a go. Thanks so far!
0
 

Author Comment

by:ClaytonGlass
ID: 40226640
OK - here is the code I put onto a button on the userform:

Sheets("Job list").Range("A501").Value = Me.Controls("TextBox1").Text
TextBox2.RowSource = Sheets("Job list").Range("B501").Value

On the sheet cell B501 is a VLOOKUP of the adjacent cell in the range for the job selected in the list. A501 works, B501 reads the lookup, but the data does not return to textbox2 on the form.
Error "could not set RowSource Property. Member not found". Do you know what this is - and how to resolve?
Thanks!
0
 

Author Closing Comment

by:ClaytonGlass
ID: 40226659
My mistake. Changed .rowsource to .value and now works fine! Thank you very much!
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question