Count number of textboxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!!
 
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
 
I repeat, show the code!

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

april27 said:
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!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top