• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Dynamically create checkboxes

tomas

Active Member
Hi based on link below I created a macro which is supposed to create checkboxes for every value from dynamic range. WHile running I got an compile error "incorrect use of ME keyword" . Can someone explain ?

thanks

http://stackoverflow.com/questions/...-based-on-cell-value?answertab=active#tab-top


Code:
Sub test()

Dim i As Integer
Dim cell As Range
Dim chkbox As MSForms.CheckBox
Dim x As Integer

i = Range("A1", Range("A1").End(xlDown)).Cells.Count
For x = 1 To i
   Set chkbox = Me.Controls.Add("Forms.Checkbox.1", "Checkbox_" & x)
    chkbox.Caption = Worksheets("List1").Cells(i, 1).Value
    chkbox.Left = 5
    chkbox.Top = 5 + ((i - 1) * 20)

Next x
End Sub
 
Hi thanks for the link now I understand what me means.

About to other stuff I added the subroutine into the worksheet code and now I get compile error that "controls" method or data member are not found
 
Back
Top