View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Reset TextBox values on userform

VBA doesn't support control arrays, so the syntax TextBox1(i) is all wrong.

Try the following

Dim Ctrl As MSForms.Control
For Each Ctrl In frmOrderForm.Controls
If TypeOf Ctrl Is MSForms.Textbox Then
Ctrl.Text = vbNullString
End If
Next Ctrl


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)



"Trevor Williams" wrote in
message ...
I'm trying to reset all textboxes on a form to a zero string before the
form
initializes, but without any success - what am I doing wrong?

For i = 1 To 15
frmOrderForm.TextBox1(i).Text = ""
Next i

Thanks - Trevor