Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Filling a ComboBox?

Good Day Group,

Need some hints on the following;

With the FindMethod, the Range ("A1:A10000") is scanned to find the cells
with the word "XXX". I like
the found values in the corresponding column "B" to be
stored as text in a ComboBox. What is the best method for this??

Brgds

CG Rosén


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Filling a ComboBox?

One way:

Option Explicit
Sub testme01()

Dim wks As Worksheet
Dim FoundCell As Range
Dim FirstAddress As String

Set wks = Worksheets("Sheet1")
wks.OLEObjects("ComboBox1").Object.Clear

With wks.Range("a1:a10000")

Set FoundCell = .Cells.Find(what:="xxx", after:=.Cells(.Cells.Count), _
LookIn:=xlValues, lookat:=xlPart, _
searchorder:=xlByRows, searchdirection:=xlNext, _
MatchCase:=False)

If Not FoundCell Is Nothing Then
FirstAddress = FoundCell.Address
Do
wks.OLEObjects("ComboBox1").Object.AddItem _
FoundCell.Offset(0, 1).Value

Set FoundCell = .FindNext(FoundCell)

Loop While Not FoundCell Is Nothing _
And FoundCell.Address < FirstAddress
End If
End With

End Sub

Most of this was stolen from the example for .Find in VBA's help.






"CG Rosén" wrote:

Good Day Group,

Need some hints on the following;

With the FindMethod, the Range ("A1:A10000") is scanned to find the cells
with the word "XXX". I like
the found values in the corresponding column "B" to be
stored as text in a ComboBox. What is the best method for this??

Brgds

CG Rosén


--

Dave Peterson

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
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
filling information from one cell and filling another. Dianne Excel Worksheet Functions 1 August 15th 05 08:14 PM
Zero Filling Excel Discussion (Misc queries) 4 December 17th 04 08:46 PM
filling a combobox (without being prompted to save the workbook EVERY time its opened neowok[_34_] Excel Programming 2 March 1st 04 03:39 PM
filling greg Excel Programming 2 February 20th 04 04:28 AM


All times are GMT +1. The time now is 09:43 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"