View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default How to clear items on a form?

G,

Grd wrote:
I have a user form with details such as first name and last name. IF
the user wishes to start again, I would like a clear or reset button
to clear the fields that they have typed.

Is there a way to loop through each textbox to clear it to blank?


Here's one way:

Private Sub ClearAll()
Dim ctl As Control

For Each ctl In Controls
If TypeOf ctl Is MSForms.TextBox Then
ctl.Object.Text = ""
End If
Next ctl
End Sub

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]