Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2001
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    combobox rowsource (any)

    How do I get the row source of the combobox to be adaptive. I tried something of the following sort

    mycombobox.rowsource = cells(1,8),cells(myrow,8)

    the help says that the form should be

    mycombobox.rowsource = "a1:a5"

    but that is only helpful if the rowsource is static. Please help

  2. #2
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: combobox rowsource (any)

    Kyanis

    Welcome to the Lounge.

    Here is a way that I use a lot to do what you are trying to do:

    Sub FindBoundaries()
    Dim iHowManyColumns As Integer '/Holds the Number of Columns.
    Dim lHowManyRows As Long '/Holds the Number of Rows.
    Dim oTheRangeToExamine As Range '/This is your Range.

    '/Act on the active workbook.
    With ActiveWorkbook
    '/Find the number of Columns using the activesheet.
    iHowManyColumns = .ActiveSheet.Range("A1").End(xlToRight).Column
    '/Find the number of Rows using the activesheet.
    lHowManyRows = .ActiveSheet.Range("A1").End(xlDown).Row

    '/Set the range here.
    Set oTheRangeToExamine = .ActiveSheet.Range(Cells(1, 1), Cells(lHowManyRows, _
    iHowManyColumns))
    End With
    End Sub

    Copy the above and paste it into a Module and see how it works. Definitely you can change the starting cell and the directions and what have you. Experiment with this and see if you can make it work for your purposes.

    Hope this helps.

    Wassim
    Remember Bald people never have bad hair days...
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: combobox rowsource (any)

    I think that what you want is something like this:

    <pre> mycombobox.RowSource = Range(Cells(1, 8), Cells(myrow, 8)).Address
    </pre>

    Legare Coleman

Posting Permissions

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