Add Sheets to ComboBox [Solved/Closed]

Report
Posts
77
Registration date
Saturday September 5, 2015
Status
Member
Last seen
March 8, 2017
-
Posts
77
Registration date
Saturday September 5, 2015
Status
Member
Last seen
March 8, 2017
-
Hello,

Hi
I would like to know that how to add sheets (which are exist in active workbook) in ComboBox used in Userform.

Thanks

1 reply

Posts
58
Registration date
Monday November 9, 2015
Status
Member
Last seen
December 6, 2015
14
Smuneeb,

Let's say we have in column A1 to A5
A1 = 1
A2 = 2
A3 = 3
A4 = 4
A5 = 5

- Right click your combobox and choose "Format Control".
- Click on the "Input Range" field.
- Click cell A1 and drag all the way to A5.

That's it. Click on the combobox and you have all the values in it.
1
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2942 users have said thank you to us this month

Posts
77
Registration date
Saturday September 5, 2015
Status
Member
Last seen
March 8, 2017
1
Hi
this is ok but I have requested that ComboBox shows no of sheets which is existed in workbook. Please do it in UserForm.
Thanks
>
Posts
77
Registration date
Saturday September 5, 2015
Status
Member
Last seen
March 8, 2017

Either of these should do what you need.

Private Sub UserForm_Initialize()
ComboBox1.List = Array("Red", "Green", "Yellow", "Blue")
End Sub

Private Sub UserForm_Initialize()
With ComboBox1
    .Clear
    .AddItem "Red"
    .AddItem "Green"
    .AddItem "Yellow"
    .AddItem "Blue"
End With
End Sub


Private Sub UserForm_Initialize()
With ComboBox1
    .Clear
    .AddItem "Red"
    .AddItem "Green"
    .AddItem "Yellow"
    .AddItem "Blue"
End With
End Sub
Or this???
Private Sub userform_Initialize()
ComboBox1.Clear

For n = 1 To Worksheets.Count
    ComboBox1.AddItem Worksheets(n).Name
Next n

End Sub

Posts
77
Registration date
Saturday September 5, 2015
Status
Member
Last seen
March 8, 2017
1
Hi
Great RayH
How could I Thank You
Marvelous Job

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!