Clearing trext box values

  • Thread starter Thread starter Risky Dave
  • Start date Start date
R

Risky Dave

Hi,

is there a way to clear all the etxtboxes in a form (something like
fmTest.AllTextBoxes.Clear) rather than having to list them individually?

TIA

Dave
 
There's always a way...

Private Sub cmdNewPT_Click()
Dim C As MSForms.Control
For Each C In Me.Controls
If TypeOf C Is MSForms.TextBox Then
C.Text = ""
End If
Next C
End Sub

HTH,
Ryan---
 
Assuming fmTest is a UserForm, give this code a try...

Dim C As Object
For Each C In Me.Controls
If TypeName(C) = "TextBox" Then C.Text = ""
Next
 
Back
Top