Add Sheets to ComboBox [Solved/Closed]

Posts
77
Registration date
Saturday September 5, 2015
Last seen
March 8, 2017
- - Latest reply: smuneeb
Posts
77
Registration date
Saturday September 5, 2015
Last seen
March 8, 2017
- Nov 24, 2015 at 07:07 AM
Hello,

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

Thanks

See more 

1 reply

Best answer
Posts
58
Registration date
Monday November 9, 2015
Last seen
December 6, 2015
17
1
Thank you
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.

Say "Thank you" 1

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

CCM 3495 users have said thank you to us this month

smuneeb
Posts
77
Registration date
Saturday September 5, 2015
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
> smuneeb
Posts
77
Registration date
Saturday September 5, 2015
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

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