refresh combobox

M

mEl

hi guys,

pretty new to the programming of excel and would like to ask bout this
question.

Here's what i have done so far:

i have a two comboboxes (i.e. ComboBox A and B)
say i have a few values in ComboBoxA and when a user selects a certain
value, ComboBoxB would change it's ListFillRange according to the value
selected in ComboBoxA. However, the values in ComboBoxB would not update
itself unless i manually change the values in ComboBoxB.
anyone can help me in terms of how to refresh the ListFillRange in ComboBoxB
when a selection in ComboBoxA is changed?


my code:

Private Sub ComboBox2_Change()

If ComboBox1.Value = "A" Then
ComboBox2.ListFillRange = "AList"

Else
ComboBox2.ListFillRange = "BList"

End If

End Sub



Thanks in Advance,

Melvin
 
P

Per Jessen

Hello Melvin

As you change the value of ComboBox A, you need to use the event code for
ComboBox 1 not ComboBox 2.

Private Sub ComboBox1_Change()

If ComboBox1.Value = "A" Then
ComboBox2.ListFillRange = "AList"
Else
ComboBox2.ListFillRange = "BList"
End If
me.Repaint
End Sub

Regards,
Per
 
M

mEl

Hey thanks buddy!

it worked!

Melvin

Per Jessen said:
Hello Melvin

As you change the value of ComboBox A, you need to use the event code for
ComboBox 1 not ComboBox 2.

Private Sub ComboBox1_Change()

If ComboBox1.Value = "A" Then
ComboBox2.ListFillRange = "AList"
Else
ComboBox2.ListFillRange = "BList"
End If
me.Repaint
End Sub

Regards,
Per
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top