Hi ALL
I am trying to show a ComboBox in Excel which should allow the user to select the required UserForm. My coding does not work, even though I have used the same coding before.
Please see the attached example.
Thanks a lot!
Hi ALL
I am trying to show a ComboBox in Excel which should allow the user to select the required UserForm. My coding does not work, even though I have used the same coding before.
Please see the attached example.
Thanks a lot!
Last edited by sgp; 12-12-2011 at 04:38 AM.
Something similar to this?
hi sgp,
I use the snb's code for it, it works for me, try the attachement
Regards, John55
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please mark your Thread as SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
...enjoy -funny parrots-
Thanks for your help guys
The way the code is written shows all userforms in one combo box - could this be adjusted so that combobox1 shows xyz userforms and combobox 2 shows 123 userforms.
Thanks a lot!
or
and![]()
Private Sub Workbook_Open() Dim cp As Object For Each cp In ThisWorkbook.VBProject.VBComponents If cp.Type = 3 Then c01 = c01 & "|" & cp.Name Next Sheets("Sheet1").ComboBox1.List = Split(Mid(c01, 2), "|") Set cp = Nothing End Sub
![]()
Private Sub ComboBox1_Change() Select Case ComboBox1.ListIndex Case 0 UserForm1.Show 0 Case 1 UserForm2.Show 0 End Select End Sub
What reason do you have for multiple UserForms?
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
I have userforms based on different categories. I would like the following combobox:
1- where the user can select the main categories
2 - lists of categories that are not classed as the main categories.
I think you would be better with one userform & a select categories on that userform, it's really hard to advise without knowing what the end project is
Thanks for the suggestion - the forms are slightly detailed and I dont think I would be able to fit everything on one form.
Then a MultiPage control. Usually a a UserForm is used for Data entry so really I would expect the data to be similar
or using the snb'code ....see if it helps you
and the code for comboboxes![]()
Private Sub Workbook_Open() For Each cp In ThisWorkbook.VBProject.VBComponents If cp.Type = 3 Then c01 = c01 & "|" & cp.Name Next Sheets("Sheet1").ComboBox2.List = Array("UserForm1", "UserForm2") ''Split(Mid(c01, 2), "|") Sheets("Sheet1").ComboBox3.List = Array("UserForm3", "UserForm4") ''Split(Mid(c01, 2), "|") End Sub
![]()
Private Sub ComboBox2_Change() Select Case ComboBox2.ListIndex Case 0 UserForm1.Show Case 1 UserForm2.Show End Select End Sub
![]()
Private Sub ComboBox3_Change() Select Case ComboBox3.ListIndex Case 0 UserForm3.Show Case 1 UserForm4.Show End Select End Sub
Hi john
That works brilliantly - thanks a lot!
hi sgp,
glad to be of help, I've just modified a little bit the snb's code.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks