Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You're welcome, Bob.
Don't change the name of the sub. It has to be UserForm_Initialize regardless of what you name your userform. You can use the dropdown boxes at the top of the code pane for the userform's class module to make sure you have it right. Select Userform from the left and Initialize from the right. -- Dick Kusleika MVP - Excel www.dicks-clicks.com Post all replies to the newsgroup. "bob cochran" wrote in message ... The following was submitted to me from another post. (Thanks Dick) The only changes I made were changing "UserForm_Initialize" to "frmMaintest_Initialize". The items are not showing in the combobox(s). Do I still need to include a reference in the Row Source of the ComboBox(s)? I am using XP and think this could be to blame. Can someone take a look and see if something is missing? I want to use the same list, but limit which combobox(s) show which items. Thanks in advance! Bob C. Sheet1.Range("a1:a3") contains Card1 Card2 Card3 Userform1 has three comboboxes with Tag properties of Card1;Card2 Card2;Card3 All respectively. In the initialize event of the form, I populate the comboboxes based on their Tags Private Sub UserForm_Initialize() Dim CardRng As Range Dim Cell As Range Dim Ctl As Control Dim AllowedCards As Variant Dim i As Long Set CardRng = Sheet1.Range("a1:A3") For Each Ctl In Me.Controls If TypeName(Ctl) = "ComboBox" Then If Len(Ctl.Tag) 0 Then If Ctl.Tag = "All" Then For Each Cell In CardRng.Cells Ctl.AddItem Cell.Value Next Cell Else AllowedCards = Split(Ctl.Tag, ";") For Each Cell In CardRng.Cells For i = LBound(AllowedCards) To _ UBound(AllowedCards) If Cell.Value = AllowedCards(i) Then Ctl.AddItem Cell.Value End If Next i Next Cell End If End If End If Next Ctl End Sub *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding data only if adjacent to cell labeled "male"/"female" | Excel Worksheet Functions | |||
Pivot (Data Items "Count" vs "Sum") | Excel Discussion (Misc queries) | |||
How do I move a document from "recent items" to "documents" | New Users to Excel | |||
"Control" plus "click" doesn't allow me to select multiple cells | New Users to Excel | |||
Scroll Bar missing "Control" tab in "Format Properties" dialog box | Excel Discussion (Misc queries) |