Re: Count number of textboxes



Public Function countTextboxes(oUF As UserForm) As Long
Dim iCtrl As Long
For iCtrl = 0 To oUF.Controls.Count - 1
If TypeName(oUF.Controls(iCtrl)) = "TextBox" Then
countTextboxes = countTextboxes + 1
End If
Next iCtrl
End Function

That might be sufficient for Dimming your array, not to populate it.

HTH
--
AP

"april27" <april27@xxxxxxxxxxxxxxxxxxxxxxxxx> a écrit dans le message de
news: 480B1A56-10F9-4400-A67A-90C73BACFAA2@xxxxxxxxxxxxxxxx
hi. anyone knows how to count the number of textboxes in a user field. i
want
to create an array in which i insert the values from the textboxes. since
the
number of textboxes is variable i want the length of the array to be
varaiable. therefore it would be great if you could count the number of
textboxes and then set the length of the equal to that. PLease help
neede!!


.