lundi 5 janvier 2015

VBA dynamic checkboxes positioning

I have an Excel VBA userform where I am attempting to add a number of checkboxes according to the number of items in a given dictionary.


This works, but each of my checkboxes is added to the top left corner, on top of each other. How can I place them so that the newest one is immediately below the previous?


Here is my relevant code:



With CreateObject("Scripting.Dictionary")
'Variable Checkboxes
Dim i As Long
Dim chkBox As MSForms.CheckBox
For i = 1 To .count - 1
Set chkBox = Me.Controls.Add("Forms.Checkbox.1", "Checkbox" & i)
chkBox.Caption = .Keys()(i)
chkBox.VALUE = False
Next i




Aucun commentaire:

Enregistrer un commentaire