+ Reply to Thread
Results 1 to 4 of 4

ComboBox RowSource Question

  1. #1
    Mike Samyn
    Guest

    ComboBox RowSource Question

    For a given form can I reference multiple sheets within a workbook? Here is
    what I tried to do but it failed on the second ComboBox.

    ....
    ComboBox1.RowSource = Sheets("Sheet1").Range(Cells(1,1),Cells(10,3).Address
    .....
    .....

    ComboBox2.RowSource = Sheets("Sheet2").Range(Cells(1,1),Cells(10,3).Address


    Thanks
    Mike

  2. #2
    Ron de Bruin
    Guest

    Re: ComboBox RowSource Question

    Hi Mike

    I miss one )

    And Cells use the cells on the activesheet now so you must use it like this

    Sheets("Sheet2").Range(Sheets("Sheet2").Cells(1, 1), Sheets("Sheet2").Cells(10, 3)).Address



    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "Mike Samyn" <MikeSamyn@discussions.microsoft.com> wrote in message news:EF9DCEB6-1456-47E0-8F46-1157874960E6@microsoft.com...
    > For a given form can I reference multiple sheets within a workbook? Here is
    > what I tried to do but it failed on the second ComboBox.
    >
    > ...
    > ComboBox1.RowSource = Sheets("Sheet1").Range(Cells(1,1),Cells(10,3).Address
    > ....
    > ....
    >
    > ComboBox2.RowSource = Sheets("Sheet2").Range(Cells(1,1),Cells(10,3).Address
    >
    >
    > Thanks
    > Mike




  3. #3
    Mike Samyn
    Guest

    Re: ComboBox RowSource Question

    Ron,

    I not sure I fully understand but I think what your'e telling me is that the
    range refence refers to the active sheet only. I haven't tried this yet but
    what if I switch active sheets between combox setups. Would that then allow
    me to have multiple combo boxs ref. multiple sheet concurently?

    --
    Mike


    "Ron de Bruin" wrote:

    > Hi Mike
    >
    > I miss one )
    >
    > And Cells use the cells on the activesheet now so you must use it like this
    >
    > Sheets("Sheet2").Range(Sheets("Sheet2").Cells(1, 1), Sheets("Sheet2").Cells(10, 3)).Address
    >
    >
    >
    > --
    > Regards Ron de Bruin
    > http://www.rondebruin.nl
    >
    >
    >
    > "Mike Samyn" <MikeSamyn@discussions.microsoft.com> wrote in message news:EF9DCEB6-1456-47E0-8F46-1157874960E6@microsoft.com...
    > > For a given form can I reference multiple sheets within a workbook? Here is
    > > what I tried to do but it failed on the second ComboBox.
    > >
    > > ...
    > > ComboBox1.RowSource = Sheets("Sheet1").Range(Cells(1,1),Cells(10,3).Address
    > > ....
    > > ....
    > >
    > > ComboBox2.RowSource = Sheets("Sheet2").Range(Cells(1,1),Cells(10,3).Address
    > >
    > >
    > > Thanks
    > > Mike

    >
    >
    >


  4. #4
    Ron de Bruin
    Guest

    Re: ComboBox RowSource Question

    You must always refer to the correct sheet with Cells
    You can run the code thern with any sheet active

    With Sheets("Sheet2")
    ComboBox2.RowSource = .Range(.Cells(1, 1), .Cells(10, 3)).Address
    End With


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "Mike Samyn" <MikeSamyn@discussions.microsoft.com> wrote in message news:F089624B-0C12-4F41-9824-99786FFEE22B@microsoft.com...
    > Ron,
    >
    > I not sure I fully understand but I think what your'e telling me is that the
    > range refence refers to the active sheet only. I haven't tried this yet but
    > what if I switch active sheets between combox setups. Would that then allow
    > me to have multiple combo boxs ref. multiple sheet concurently?
    >
    > --
    > Mike
    >
    >
    > "Ron de Bruin" wrote:
    >
    >> Hi Mike
    >>
    >> I miss one )
    >>
    >> And Cells use the cells on the activesheet now so you must use it like this
    >>
    >> Sheets("Sheet2").Range(Sheets("Sheet2").Cells(1, 1), Sheets("Sheet2").Cells(10, 3)).Address
    >>
    >>
    >>
    >> --
    >> Regards Ron de Bruin
    >> http://www.rondebruin.nl
    >>
    >>
    >>
    >> "Mike Samyn" <MikeSamyn@discussions.microsoft.com> wrote in message news:EF9DCEB6-1456-47E0-8F46-1157874960E6@microsoft.com...
    >> > For a given form can I reference multiple sheets within a workbook? Here is
    >> > what I tried to do but it failed on the second ComboBox.
    >> >
    >> > ...
    >> > ComboBox1.RowSource = Sheets("Sheet1").Range(Cells(1,1),Cells(10,3).Address
    >> > ....
    >> > ....
    >> >
    >> > ComboBox2.RowSource = Sheets("Sheet2").Range(Cells(1,1),Cells(10,3).Address
    >> >
    >> >
    >> > Thanks
    >> > Mike

    >>
    >>
    >>




+ 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