poopiebear
New Member
- Joined
- Nov 19, 2010
- Messages
- 41
Hello All,
I have several UserForms with ComboBoxes that need to populated with the same data. To prevent having to code each UserForm with the contents of the ComboBoxes, is it possible to call up code from a Module? I tried it and it gave me errors. I think one issue is that I'm populating my ComboBoxes upon Activating the UserForm. Here is the code that works that I have on each UserForm.
Thanks for any help!
I have several UserForms with ComboBoxes that need to populated with the same data. To prevent having to code each UserForm with the contents of the ComboBoxes, is it possible to call up code from a Module? I tried it and it gave me errors. I think one issue is that I'm populating my ComboBoxes upon Activating the UserForm. Here is the code that works that I have on each UserForm.
Thanks for any help!
Code:
Private Sub UserForm_Activate()
With Me
'This will create a vertical scrollbar
.ScrollBars = fmScrollBarsVertical
'Change the values of 2 as Permission your requirements
.ScrollHeight = .InsideHeight * 2
.ScrollWidth = .InsideWidth * 9
End With
TextBox1.SetFocus
With CommandButton1
.Caption = ""
End With
With ComboBox1
.AddItem ""
.AddItem "Mr."
.AddItem "Mrs."
.AddItem "Ms."
End With
With ComboBox2
.AddItem ""
.AddItem "Male"
.AddItem "Female"
End With
'There are other actions here that are specific to each UserForm
End Sub