ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform ComboBox Row Source (https://www.excelbanter.com/excel-programming/442813-userform-combobox-row-source.html)

Brad

Userform ComboBox Row Source
 
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

Mike

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

"Brad" wrote:

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



All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com