Number of comboboxes in a userform

Solved
jucva Posted messages 27 Status Member -  
jucva Posted messages 27 Status Member -
Hello,

I would like to count the number of ComboBox objects present in a userform???

Or if someone can tell me if it is possible to apply the following code:

Dim Cb as ComboBox

For Each Cb in Userform

" action"

Next Cb

Thank you for your help.

JF

1 answer

  1. pijaku Posted messages 13513 Registration date   Status Moderator Last intervention   2 772
     
    Hello,

    Your code cannot work.
    This one can:

    Dim Ctrl As Control, Cpt As Integer For Each Ctrl In Userform1.Controls If TypeOf Ctrl Is MSForms.ComboBox Then Cpt = Cpt + 1 Next Ctrl


    --
    🎼 Best regards,
    Franck 🎶
    1
    1. jucva Posted messages 27 Status Member 2
       
      Perfect. Thank you.
      0