I currently have the following attached to a button to reset a form.
This works fine except for one thing - Any items that have been selected in a ListBox remain selected.'Reset button Private Sub ResetBut_Click() Dim ctl As MSForms.Control For Each ctl In Me.Controls Select Case TypeName(ctl) Case "TextBox" ctl.Text = "" Case "CheckBox", "OptionButton", "ToggleButton" ctl.Value = True Case "ComboBox", "ListBox" ctl.ListIndex = 0 End Select Next ctl End Sub
I'm sure thatmight be what is required, but I do not know how to effectively incorporate it in my Reset Button code. Mind you, this will only deselect anything in ListBox1. What could be used to clear all ListBoxes?Listbox1.ListIndex = -1
Alternatively someone might a have a better and complete option that negates using my code altogether!
Thanks!