Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot table cutting information of a part of the information ASR Excel Discussion (Misc queries) 1 November 5th 09 02:09 PM
Help with looking up information Needing Help Excel Discussion (Misc queries) 3 April 30th 09 02:49 AM
Help!! using sheet 1 information to change information on sheet 2 I want to learn more Excel Worksheet Functions 2 September 30th 08 05:25 PM
Information on one tab to another Chey Excel Discussion (Misc queries) 4 August 1st 07 02:40 AM
Information from one cell pulls information from another cell ACTLibrarian Excel Programming 1 November 13th 04 04:01 PM


All times are GMT +1. The time now is 04:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"