+ Reply to Thread
Results 1 to 3 of 3

RowSource in ListBox

  1. #1
    Noah
    Guest

    RowSource in ListBox

    Is it possible to have the rowsource in a listbox set to the following range
    ("rng") that I have defined in a vb module? I keep getting the following
    message: "Could not set the RowSource property. Invalid property value." Do
    I need to insert the code somewhere else? Thank you!
    ----
    Dim rng As Range
    lastrow = Cells(1, 1).End(xlDown).Row
    rng = Sheet1.Range(Cells(1, 1), Cells(lastrow, 2))
    ----------


  2. #2
    chijanzen
    Guest

    RE: RowSource in ListBox

    Hi Noah:

    Try

    Dim rng As Range
    lastrow = Cells(1, 1).End(xlDown).Row
    Set rng = Sheet1.Range(Sheet1.Cells(1, 1), Sheet1.Cells(lastrow, 2))
    Me.ListBox1.RowSource = rng.Address

    --
    http://www.vba.com.tw/plog/


    "Noah" wrote:

    > Is it possible to have the rowsource in a listbox set to the following range
    > ("rng") that I have defined in a vb module? I keep getting the following
    > message: "Could not set the RowSource property. Invalid property value." Do
    > I need to insert the code somewhere else? Thank you!
    > ----
    > Dim rng As Range
    > lastrow = Cells(1, 1).End(xlDown).Row
    > rng = Sheet1.Range(Cells(1, 1), Cells(lastrow, 2))
    > ----------
    >


  3. #3
    Noah
    Guest

    RE: RowSource in ListBox

    Thank you for your help, but, unfortunately, I still can't seem to get it to
    work. Since several days have elapsed since the original post, I will post
    the question again.

    "chijanzen" wrote:

    > Hi Noah:
    >
    > Try
    >
    > Dim rng As Range
    > lastrow = Cells(1, 1).End(xlDown).Row
    > Set rng = Sheet1.Range(Sheet1.Cells(1, 1), Sheet1.Cells(lastrow, 2))
    > Me.ListBox1.RowSource = rng.Address
    >
    > --
    > http://www.vba.com.tw/plog/
    >
    >
    > "Noah" wrote:
    >
    > > Is it possible to have the rowsource in a listbox set to the following range
    > > ("rng") that I have defined in a vb module? I keep getting the following
    > > message: "Could not set the RowSource property. Invalid property value." Do
    > > I need to insert the code somewhere else? Thank you!
    > > ----
    > > Dim rng As Range
    > > lastrow = Cells(1, 1).End(xlDown).Row
    > > rng = Sheet1.Range(Cells(1, 1), Cells(lastrow, 2))
    > > ----------
    > >


+ 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