+ Reply to Thread
Results 1 to 6 of 6

Where should my ListBox code go?

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Where should my ListBox code go?

    I Have 2 ListBoxes on a UserForm
    I want the RowSource of one ListBox to be chosen by the Value of the first ListBox .
    The following code is meant to achieve this.
    Please Login or Register  to view this content.
    This sub is not activated probably because it is in the wrong place in the code of the UserForm.
    I have tried other places but none get the sub to be run. Where should it go?
    John

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Where should my ListBox code go?

    Is LBName a single or multiple select listbox?

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Where should my ListBox code go?

    Put it into/call it from the LBMc change event, and remove the period in front of "Me".
    Remember what the dormouse said
    Feed your head

  4. #4
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Where should my ListBox code go?

    I am now calling from LBMc change event and the procedure is now being activated. After you found the faulty point I changed the code to this
    Please Login or Register  to view this content.
    which seems to be correct. However on line 10 I am getting a type mismatch error. The named ranges are in position so I am at a loss as to how to progress. Can you help a bit more?
    John

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,097

    Re: Where should my ListBox code go?

    Using RowSource you need to supply an address
    Please Login or Register  to view this content.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Where should my ListBox code go?

    Or just use the name directly:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] if anything in listbox select first item, if listbox empty do nothing (listbox in userform
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2015, 12:49 PM
  2. [SOLVED] run code if anything selected in any listbox
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2013, 03:27 PM
  3. [SOLVED] Insert listbox code into this code
    By nickmax1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2013, 01:14 PM
  4. Listbox to Listbox, no duplicates & submitting same UserForm data for each Listbox entry.
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2012, 12:18 PM
  5. [SOLVED] MORE listbox code
    By Jennifer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-25-2006, 10:50 PM
  6. [SOLVED] listbox code
    By Jennifer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2006, 02:50 PM
  7. Modification of listbox to listbox code
    By Sam S via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-28-2005, 07:05 AM

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