+ Reply to Thread
Results 1 to 10 of 10

Setting Rowsource for Listbox

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Setting Rowsource for Listbox

    I'm having the most awful time trying to set up my rowsource for my Listbox, and would appreciate some help.

    My UserForm has a name, "SelectDate"
    My listbox in the userform has a name, "Listbox1"
    In the Properties section of "Listbox1" I've left the "Rowsource" blank

    My data to populate the listbox is in the current workbook, in a sheet called "Steps", in column G. This data is in Dynamic Named Range. The name is "Dates", the "refers to" section says "=OFFSET(Steps!G1,0,0,COUNTA(Steps!$G:$G),1)"

    I have the following code in place:
    Please Login or Register  to view this content.
    I've tried it with and without keying "SelectDate". Whichever way I go when I run the code I get a Run-time error 13, Type Mismatch.

    What am I doing wrong?

    I would appreciate any help I can get.
    Last edited by jomili; 09-30-2010 at 11:23 AM.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Setting Rowsource for Listbox

    Rowsource takes an address string, not a range. I suggest you don't use it though - assign the value of the range to the List property of the listbox instead.
    Remember what the dormouse said
    Feed your head

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Setting Rowsource for Listbox

    When I look at the properties on the Listbox I don't see "List", only "ListStyle". I've tried using the "RowSource", but can't get that to behave either.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Setting Rowsource for Listbox

    Try
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Setting Rowsource for Listbox

    Roy,
    That got us past the runtime error, but my userform comes up with an empty Listbox.

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Setting Rowsource for Listbox

    Then there is no data in the range.
    To use the rowsource (but don't!) you would use:
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Setting Rowsource for Listbox

    I decided it might help to have an example, so I've attached one.
    Attached Files Attached Files

  8. #8
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Setting Rowsource for Listbox

    Your range name is defined incorrectly. The B2 reference needs to be $B$2

  9. #9
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Setting Rowsource for Listbox

    I knew it had to be something simple. I don't know how my value changed from G1 to B1, but I did not have my $ in place, so I guess it would change. I at that about a hundred times, and never saw that piece. Thanks so much!

  10. #10
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Setting Rowsource for Listbox

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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