ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count number of textboxes (https://www.excelbanter.com/excel-programming/364663-count-number-textboxes.html)

april27

Count number of textboxes
 
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!!

Ardus Petus

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" a écrit dans le message de
news: ...
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!!




Bob Phillips

Count number of textboxes
 
I repeat, show the code!

--
HTH

Bob Phillips

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

"april27" wrote in message
...
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!!




All times are GMT +1. The time now is 12:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com