Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default filling combo box

What is the best way to fill a combo box when the data is stored in an
external file?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default filling combo box

Mike,

Open the file
Either copy the data to the combobox file and point the combobox at that
data, or add them to the combobox
Close the file

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike" wrote in message
news:g%mQb.7451$U%5.52032@attbi_s03...
What is the best way to fill a combo box when the data is stored in an
external file?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default filling combo box

Is there a site with sample code? This is a combo box on the worksheet, not
a userform.


"Bob Phillips" wrote in message
...
Mike,

Open the file
Either copy the data to the combobox file and point the combobox at that
data, or add them to the combobox
Close the file

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike" wrote in message
news:g%mQb.7451$U%5.52032@attbi_s03...
What is the best way to fill a combo box when the data is stored in an
external file?






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default filling combo box

what kind of file is the data stored in?

--
Regards,
Tom Ogilvy


Mike wrote in message
news:jvyQb.109927$Rc4.780708@attbi_s54...
Is there a site with sample code? This is a combo box on the worksheet,

not
a userform.


"Bob Phillips" wrote in message
...
Mike,

Open the file
Either copy the data to the combobox file and point the combobox at that
data, or add them to the combobox
Close the file

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike" wrote in message
news:g%mQb.7451$U%5.52032@attbi_s03...
What is the best way to fill a combo box when the data is stored in an
external file?








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default filling combo box

Mike,

This is the sort of thing.

This example loads the combobox directly

Workbooks.Open Filename:="c:\myTest\Testfile_1.xls"
With ThisWorkbook.Worksheets("Sheet1")
For i = 1 To 10
.ComboBox1.AddItem ActiveSheet.Range("B" & i).Value
Next i
.ComboBox1.ListIndex = 0
End With
ActiveWorkbook.Close

This example copies the data to this workbook and directs the combobox to
that data

Workbooks.Open Filename:="c:\myTest\Testfile_1.xls"
With ThisWorkbook.Worksheets("Sheet1")
ActiveSheet.Range("D1:D10").Copy .Range("A1")
.ComboBox1.ListFillRange = "A1:A10"
.ComboBox1.ListIndex = 0
End With
ActiveWorkbook.Close


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike" wrote in message
news:jvyQb.109927$Rc4.780708@attbi_s54...
Is there a site with sample code? This is a combo box on the worksheet,

not
a userform.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default filling combo box

excel 2000 and fixed width text file. text file contains over 1000 records


"Tom Ogilvy" wrote in message
...
what kind of file is the data stored in?

--
Regards,
Tom Ogilvy


Mike wrote in message
news:jvyQb.109927$Rc4.780708@attbi_s54...
Is there a site with sample code? This is a combo box on the worksheet,

not
a userform.


"Bob Phillips" wrote in message
...
Mike,

Open the file
Either copy the data to the combobox file and point the combobox at

that
data, or add them to the combobox
Close the file

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike" wrote in message
news:g%mQb.7451$U%5.52032@attbi_s03...
What is the best way to fill a combo box when the data is stored in

an
external file?










  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default filling combo box

Thanks for the code. I would prefer to use the first code example. But I
am having trouble programming with columncount property. I have 3 columns
to be displayed in the combobox.
I do I do that? BoundColumn will be set to 1.

Lastly, how do I sort the values within the combo box?


"Bob Phillips" wrote in message
...
Mike,

This is the sort of thing.

This example loads the combobox directly

Workbooks.Open Filename:="c:\myTest\Testfile_1.xls"
With ThisWorkbook.Worksheets("Sheet1")
For i = 1 To 10
.ComboBox1.AddItem ActiveSheet.Range("B" & i).Value
Next i
.ComboBox1.ListIndex = 0
End With
ActiveWorkbook.Close

This example copies the data to this workbook and directs the combobox to
that data

Workbooks.Open Filename:="c:\myTest\Testfile_1.xls"
With ThisWorkbook.Worksheets("Sheet1")
ActiveSheet.Range("D1:D10").Copy .Range("A1")
.ComboBox1.ListFillRange = "A1:A10"
.ComboBox1.ListIndex = 0
End With
ActiveWorkbook.Close


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike" wrote in message
news:jvyQb.109927$Rc4.780708@attbi_s54...
Is there a site with sample code? This is a combo box on the worksheet,

not
a userform.






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default filling combo box

This pseudo code should show you how to do it.

Dim rng as Range
Workbooks.Open Filename:="c:\myTest\Testfile_1.xls"
With Activesheet.
.sort Key1:=.Range("A1'), _
Order1:=xlAscending, Header:=xlNo
set rng = .Range("A1").CurrentRegion
End With
With Userform1.Combobox1
.Columncount = 3
.List = rng.Value
.BoundColumn = 1
End With
Activeworkbook.Close SaveChanges:=False


--
Regards,
Tom Ogilvy


Mike wrote in message
news:JMTQb.19188$U%5.139067@attbi_s03...
Thanks for the code. I would prefer to use the first code example. But I
am having trouble programming with columncount property. I have 3 columns
to be displayed in the combobox.
I do I do that? BoundColumn will be set to 1.

Lastly, how do I sort the values within the combo box?


"Bob Phillips" wrote in message
...
Mike,

This is the sort of thing.

This example loads the combobox directly

Workbooks.Open Filename:="c:\myTest\Testfile_1.xls"
With ThisWorkbook.Worksheets("Sheet1")
For i = 1 To 10
.ComboBox1.AddItem ActiveSheet.Range("B" & i).Value
Next i
.ComboBox1.ListIndex = 0
End With
ActiveWorkbook.Close

This example copies the data to this workbook and directs the combobox

to
that data

Workbooks.Open Filename:="c:\myTest\Testfile_1.xls"
With ThisWorkbook.Worksheets("Sheet1")
ActiveSheet.Range("D1:D10").Copy .Range("A1")
.ComboBox1.ListFillRange = "A1:A10"
.ComboBox1.ListIndex = 0
End With
ActiveWorkbook.Close


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike" wrote in message
news:jvyQb.109927$Rc4.780708@attbi_s54...
Is there a site with sample code? This is a combo box on the

worksheet,
not
a userform.








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
filling combo boxes from single outer source alekm Excel Discussion (Misc queries) 1 February 17th 06 01:49 PM
filling information from one cell and filling another. Dianne Excel Worksheet Functions 1 August 15th 05 08:14 PM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 1 February 16th 05 02:05 AM
Filling a combo box from another workbook John Excel Programming 4 November 20th 03 05:59 PM
Filling multiple cells based on 1 combo box selection Serrena Carter Excel Programming 1 August 30th 03 02:14 PM


All times are GMT +1. The time now is 12:33 PM.

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"