combobox

S

sunilpatel

I have create a combbox using toolbars>Control Toolbox. (not used User Form)
I can populate it by altering ListFillRange in properties. What i actually
need to do is, using code i want to populate combobox with a range on a
second sheet E.G Sheet2 range A1:A10 but ommiting any blank cells in this
range.

Is this possible? Not used comboboxs before!

Please help in newbie talk!

Sunil
 
H

Harald Staff

This macro will do it:

Sub FillCombo()
Dim Cel As Range
Sheets("Sheet1").ComboBox1.Clear
For Each Cel In Sheets("Sheet2").Range("A1:A10")
If Cel.Value <> "" Then
Sheets("Sheet1").ComboBox1.AddItem Cel.Value
End If
Next
End Sub


question is When -and Why. You'll have to run this manually as is.

HTH. Best wishes Harald
 
S

sunilpatel

Thanks but, i am getting an error message. "Object does'nt support this
property or method"

Please help
 

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