+ Reply to Thread
Results 1 to 3 of 3

Further Information

  1. #1
    3axles
    Guest

    Further Information

    Hi I Was Wondering if i was able to get a more indepth example

    Currently when I set up comboBox's i Insert Values by using "Add Item"
    eg With UserFrom.cboxLocation
    .AddItem "A"
    End With
    However This is only suitable when the list is small
    I Need to be Able to fill a combobox with hundreds of values.
    I want to set my Form up so that i can click a button and in doing so
    places values into the combobox.
    The values which need to go into the combobox are located in seperate
    worksheet.
    ie Roads Starting with "A" are located in column A of the worksheet

    Any Input would be much Appreciated


  2. #2
    Zack Barresse
    Guest

    Re: Further Information

    Hi there,

    You may be a good candidate for a Loop. There are many types of loops, here
    is an example of one ...

    Sub tesing()
    Dim i as Long
    With Sheets("Sheet2")
    For i = 1 to .Range("A65536").end(xlup).Row Step 1
    Me.Combobox1.Additem .Range("A" & i).Text
    Next
    End Sub

    You may need to adjust this as you see fit. But it's the basics. Just
    remember, loops can be inefficient if they are misused or are used
    inappropriately. Small loops are generally not that bad.

    Hope this helps!

    --
    Regards,
    Zack Barresse, aka firefytr

    "3axles" <[email protected]> wrote in message
    news:[email protected]...
    > Hi I Was Wondering if i was able to get a more indepth example
    >
    > Currently when I set up comboBox's i Insert Values by using "Add Item"
    > eg With UserFrom.cboxLocation
    > .AddItem "A"
    > End With
    > However This is only suitable when the list is small
    > I Need to be Able to fill a combobox with hundreds of values.
    > I want to set my Form up so that i can click a button and in doing so
    > places values into the combobox.
    > The values which need to go into the combobox are located in seperate
    > worksheet.
    > ie Roads Starting with "A" are located in column A of the worksheet
    >
    > Any Input would be much Appreciated
    >




  3. #3
    Tom Ogilvy
    Guest

    Re: Further Information

    or

    Private Sub Userform_Initialize()
    Dim rng as Range
    With Sheets("Sheet2")
    set rng = .Range(.Cells(1,2),.Cells(1,2).End(xldown))
    Me.Combobox1.List = rng.Value
    End With
    End sub

    --
    Regards,
    Tom Ogilvy

    "Zack Barresse" <[email protected]> wrote in message
    news:[email protected]...
    > Hi there,
    >
    > You may be a good candidate for a Loop. There are many types of loops,

    here
    > is an example of one ...
    >
    > Sub tesing()
    > Dim i as Long
    > With Sheets("Sheet2")
    > For i = 1 to .Range("A65536").end(xlup).Row Step 1
    > Me.Combobox1.Additem .Range("A" & i).Text
    > Next
    > End Sub
    >
    > You may need to adjust this as you see fit. But it's the basics. Just
    > remember, loops can be inefficient if they are misused or are used
    > inappropriately. Small loops are generally not that bad.
    >
    > Hope this helps!
    >
    > --
    > Regards,
    > Zack Barresse, aka firefytr
    >
    > "3axles" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi I Was Wondering if i was able to get a more indepth example
    > >
    > > Currently when I set up comboBox's i Insert Values by using "Add Item"
    > > eg With UserFrom.cboxLocation
    > > .AddItem "A"
    > > End With
    > > However This is only suitable when the list is small
    > > I Need to be Able to fill a combobox with hundreds of values.
    > > I want to set my Form up so that i can click a button and in doing so
    > > places values into the combobox.
    > > The values which need to go into the combobox are located in seperate
    > > worksheet.
    > > ie Roads Starting with "A" are located in column A of the worksheet
    > >
    > > Any Input would be much Appreciated
    > >

    >
    >




+ 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