Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

extract data from listbox on userform

Posted on 2014-07-28
5
Medium Priority
?
964 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
[X]
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
  • 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 1200 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

660 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