
Resetting objects in userform
For each cntrl in Userform1.Controls
if typeof cntrl is MSForms.Textbox then
cntrl.text = ""
elseif typeof cntrl is MSForms.Listbox then
cntrl.Listindex = -1
end if
Next
Note: Code has not been placed in the VBE and benchtested, so it may
contain typos.
Regards,
Tom Ogilvy
MVP Excel
Quote:
> Hi everybody,
> I have an application with quite a number of textboxes and listboxes .
> I want to reset them to their previous values when I click "reset" button
in
> the form.
> Is there a single command which will reset all the objects in a useform.
> I remember seeing something like this before here but cannot find it now.
> Any suggestions will be welcome
> -tim