+ Reply to Thread
Results 1 to 3 of 3

Used named range in listbox on userform

  1. #1
    Registered User
    Join Date
    06-06-2013
    Location
    Cape Town, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    5

    Used named range in listbox on userform

    Hello

    How would you populate a listbox on a userform with a named range?

    I have tried:

    Please Login or Register  to view this content.
    But the list only shows up when I am on the sheet that contains the data, which in this case is "DataSheet". So if i activate the userform when I am on a different sheet, there is nothing in the listbox.

    Thanks

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Used named range in listbox on userform

    include the sheetname

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Used named range in listbox on userform

    The line you used will return just a cell range like "$A$1:$B$15". It does not include a reference to the sheet. The best way to solve this is to bring up the form editor, right click on the listbox, select Properties, then in RowSource type ListBoxNames (no quotes). It looks like you always want to use the same named range so this is sufficient. You don't have to load it every time the form activates.

    You must be sure that the named range has a scope of Workbook. That's the default and it probably is unless you have used the same name for ranges on more than one worksheet.

    Just for reference, if you want to do it in code, then

    Please Login or Register  to view this content.
    Just for future reference, if you ever need a string that looks like "DataSheet!$A$1:$B$15" then you would use

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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] Populating Listbox in a Userform with a named range from another sheet
    By gruberm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-02-2013, 06:48 AM
  2. [SOLVED] VBA: UserForm ListBox Column Headings RowSource = Named Range
    By Hudas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-22-2012, 02:21 AM
  3. listbox populating on userform with named range
    By kmsoni in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-28-2011, 01:37 PM
  4. listbox populating on userform with named range
    By kmsoni in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-27-2011, 02:31 PM
  5. how to populate listbox with named range
    By kmsoni in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2011, 04:14 PM

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