
Private Sub CommandButton1_Click() For n = 1 To UserForm1.Controls.Count [a1] = UserForm1.Controls(n).Name Next End Sub |
For n = 0 To UserForm1.Controls.Count - 1
Option Explicit
Private Sub CommandButton1_Click()
Dim ctl As Object
For Each ctl In UserForm1.Controls
If TypeOf ctl Is ComboBox Then
Range("A1") = ctl.Name
End If
Next
End Sub |
Option Explicit
Private Sub CommandButton1_Click()
Dim ctl As Object
For Each ctl In UserForm1.Controls
If TypeName ctl Is "ComboBox" Then
Range("A1") = ctl.Name
End If
Next
End Sub |
