Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 159
Default Combobox questions

I would like to know what events I should use or if I should use an event for
the following questions?

1)How to capture what the user input(types) into the combobox1 and see if it
matches any names in say sheet1 column 'A'. If it does then give combobox2
focus.

2)Populate combobox2's list with names that match the name the user typed
into combobox1 from sheet2 column 'B' and continue with the entry form input.
Sheet2 looks like this. So if the user typed "john" combobox2's list would
show red,blue,brown.
column A column B
john red
fred red
john blue
jack green
john brown

3)If the user selects one of the names from combobox1 list I would like it
to do the same as item #2 above.

column 'A' from both sheets match, they just store different data
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Combobox questions

Try code for ComboBox1 like the following. Change the ranges A1:A10 to
whatever you need.

Private Sub ComboBox1_Change()
Dim S As String
Dim V As Variant
Dim R As Range

S = Me.ComboBox1.Text
V = Application.Match(S, Worksheets("Sheet1").Range("A1:A10"), 0)
If IsError(V) = False Then
With Me.ComboBox2
.Clear
For Each R In Worksheets("Sheet2").Range("A1:A10")
If R.Text = S Then
.AddItem R(1, 2)
End If
Next R
.SetFocus
If .ListCount 0 Then
.ListIndex = 0
End If
End With
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Mekinnik" wrote in message
...
I would like to know what events I should use or if I should use an event
for
the following questions?

1)How to capture what the user input(types) into the combobox1 and see if
it
matches any names in say sheet1 column 'A'. If it does then give combobox2
focus.

2)Populate combobox2's list with names that match the name the user typed
into combobox1 from sheet2 column 'B' and continue with the entry form
input.
Sheet2 looks like this. So if the user typed "john" combobox2's list would
show red,blue,brown.
column A column B
john red
fred red
john blue
jack green
john brown

3)If the user selects one of the names from combobox1 list I would like it
to do the same as item #2 above.

column 'A' from both sheets match, they just store different data


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
Answers to questions posing more questions in a workbook sbelle1 Excel Worksheet Functions 2 August 8th 09 01:02 AM
2 questions! Related to combobox and time function. HELP!! Bruno Excel Discussion (Misc queries) 11 September 28th 07 02:33 PM
MORE combobox questions N.F[_2_] Excel Programming 6 June 20th 07 01:16 AM
More combobox questions lc Excel Programming 1 September 6th 05 06:12 PM
Questions About ComboBox Chaplain Doug Excel Programming 3 February 25th 05 02:51 PM


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