Userform ComboBox Row Source

B

Brad

Thanks for taking the time to read my question.

I have a user form on which I have a ComboBox. I'd like to have the ComboBox
list the names of all the worksheets in the workbook. I've tried to make the
rowsource a list like "Test1";"Test2" or "Test1","Test2" but no luck.

If I could make the rowsource a string, I could build the string in VBA no
problem and assign the string to the combobox.

Is there a way to do this?

Thanks,

Brad
 
M

Mike

Private Sub UserForm_Initialize()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
With ComboBox1
.AddItem ws.Name
End With
Next
End Sub
 

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