Len Piwowar
04-11-2006, 11:19 AM
I have code that runs each time excel is started (.xla) and allows the user to search the current sheet for any of the names listed in a userform that is stored in the .xla project. Currently I use the code below to populate the listbox:
Private Sub UserForm_Initialize()
EmpList.AddItem "John Doe"
EmpList.AddItem "S. Smith"
EmpList.AddItem "Mr. Green"
EmpList.AddItem "Big Bird"
EmpList.AddItem "Joe Who"
EmpList.AddItem "Any Body"
EmpList.AddItem "Some One"
End Sub
I would like to be able to have the user add a new name to the list. I figure I could create a add name button calling a procedure that would show a textbox the user would enter a new name. The name would then have to be appended to the bottom of the
Private Sub UserForm_Initialize() with EmpList.Additem New Name.
How would I go about editing the VBA form code on the fly? Or is it even possible?:think:
Private Sub UserForm_Initialize()
EmpList.AddItem "John Doe"
EmpList.AddItem "S. Smith"
EmpList.AddItem "Mr. Green"
EmpList.AddItem "Big Bird"
EmpList.AddItem "Joe Who"
EmpList.AddItem "Any Body"
EmpList.AddItem "Some One"
End Sub
I would like to be able to have the user add a new name to the list. I figure I could create a add name button calling a procedure that would show a textbox the user would enter a new name. The name would then have to be appended to the bottom of the
Private Sub UserForm_Initialize() with EmpList.Additem New Name.
How would I go about editing the VBA form code on the fly? Or is it even possible?:think: