Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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" wrote in message ... 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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" wrote in message ... 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" wrote in message ... 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pivot table cutting information of a part of the information | Excel Discussion (Misc queries) | |||
Help with looking up information | Excel Discussion (Misc queries) | |||
Help!! using sheet 1 information to change information on sheet 2 | Excel Worksheet Functions | |||
Information on one tab to another | Excel Discussion (Misc queries) | |||
Information from one cell pulls information from another cell | Excel Programming |