+ Reply to Thread
Results 1 to 18 of 18

Populate Listbox with a range from one worksheet (criteria) and remove if item found

  1. #1
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Hi,

    OBJECTIVE:
    Populate Listbox with a range from one worksheet with a criteria and remove if item found on specific ranges on another worksheet.

    What I have is a worksheet with various designated ranges.

    When I select a cell a form shows and populates according to Task assigned to that cell.

    What I am trying to do is populate the listbox on the form according to criteria of task.

    If the names are used anywhere on the worksheet it is not to show in the listbox, but the listbox is only to show names matching criteria.

    I have created a workbook to try and illustrate what I have done and trying to achieve.

    Thanks..Very Kindly in Advance
    Attached Files Attached Files
    Last edited by Foreverlearning; 05-09-2012 at 03:24 AM.

  2. #2
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Hi Guys,
    I would really appreciate some help here.

    Regards

  3. #3
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Hi Again,

    I have tried myself but.... at least most of it works..

    If anybody would like to help I will upload..

    Thanks

  4. #4
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Anybody able to assist!
    Last edited by Foreverlearning; 05-05-2012 at 06:23 PM.

  5. #5
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Bump kindly...

  6. #6
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    It would be nice if someone just said something

  7. #7
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Hi, Foreverlearning. An example file you attached is not clear. Maybe you can create a different example?

  8. #8
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Hi nilem,

    Thank you so much for replying.......

    I have attached another example with more detailed notes within.

    Regards..
    Attached Files Attached Files

  9. #9
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    try it (see attached file)
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Thank you very much nilem...

    You have made me very happy mate...

    I would have to spend hours understanding your level of arrays...

    I have made some notes within file to explain a few things you mentioned

    mate you deserve a pat on the back and of course much more....

    Regards
    Lionel
    Attached Files Attached Files

  11. #11
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Hi Lionel. This is a very long time to prescribe all the codes for your forms, so I slightly modified your code and put a sample file from John Walkenbach, so you are able to do what you need.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Hi nilem,

    You have made me very happy mate in what you have done to date.

    I need to ask a few questions to understand what is happening in the code

    What does the & part mean when you declare variables

    Please Login or Register  to view this content.
    Another issue is when the Task Set 15 form loads the 5 Listboxes are full of blanks and you can click on each one

    Regards
    Lionel

  13. #13
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    & - is the abbreviated name of the variable type. & means Long, % - Integer etc.

    Listboxes filled in this procedure
    Please Login or Register  to view this content.
    and if your range F38:I42 empty, Listboxes will also be empty.

  14. #14
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Hi nilem,
    Thanks for your explanation of variables.. (Learned something new)

    As for Listboxes.. I step thru the code and yes it does bypass empty cells but when form is loaded each listbox has selectable blanks
    as in attached picture. No extra code has been added.
    Listboxes.JPG

    Creates an issue because when I try to add to listboxes the value goes to bottom of 5 blank listbox items
    and these can be deleted with a remove item.

    How can I get rid of these as form loads

    Thanks
    Lionel

  15. #15
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    I think I understand now.
    try
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Just beautiful mate, just beautiful.

    What I need to know if not too much trouble (Sorry but you are helping me but also teaching me)

    When I populate the same form listbox with names that any names in the five listboxes are removed from the large left one on loading form

    I still can't believe a chap from Russia is helping me way over here Down Under

    Thanks
    Lionel

  17. #17
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Well, try this
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Re: Populate Listbox with a range from one worksheet (criteria) and remove if item found

    Thanks Nilem,

    I will go thru and learn what you have given me..

    Have a great day mate...

    Regards
    Lionel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1