Display number of non-empty comboboxes
Solved
tav2014
Posted messages
3
Status
Member
-
Patrice33740 Posted messages 8400 Registration date Status Member Last intervention -
Patrice33740 Posted messages 8400 Registration date Status Member Last intervention -
Hello everyone
Beginner in VBA, I created a UserForm composed of ComboBoxes numbered from 1 to 20
When filling out the userform I would like to display in a textbox the number of non-filled combo boxes but only for those numbered between 8 and 17.
Thanks in advance
Beginner in VBA, I created a UserForm composed of ComboBoxes numbered from 1 to 20
When filling out the userform I would like to display in a textbox the number of non-filled combo boxes but only for those numbered between 8 and 17.
Thanks in advance
3 answers
-
Hello,
All the basics here:
https://silkyroad.developpez.com/VBA/ControlesUserForm/
and here:
https://silkyroad.developpez.com/VBA/UserForm/
--
Best regards,
Patrice -
Thank you very much for this quick response; however, I haven't found a solution to my problem. I did find a way to count all the comboboxes in my userform, but I can't adapt this procedure to only count the combo from 8 to 17.
Sub count_filled_Comboboxes(usf As Object)
Dim Ctrl As Control
Dim i As Byte
For Each Ctrl In usf.Controls
If TypeName(Ctrl) = "ComBox" Then
If Ctrl.Value <> "" Then i = i + 1
End If
Next
UserForm3.TextBox132 = i
End Sub
Thank you for your help -
In the end I managed to achieve my result as follows
Dim Ctrl As Control
Dim i As Byte
For nb = 8 To 22
If Me("Combobox" & nb).Value <> "" Then i = i + 1
Next
MsgBox ("i")
End Sub
thank you-
Well, by forging ahead...
Mark the post as resolved:
https://www.commentcamarche.net/infos/25917-marquer-un-fil-de-discussion-comme-etant-resolu/
Best regards
Patrice
-