Hello!
I have a userform which gets populated by checkboxes on the fly. For each cel in a list on a sheet, a checkbox is made. I am trying to get the control source for each checkbox to be the cell in the next column to the current cel selected. Unfortunatley, the controlsource just isn't working in the code I have written. Here's my code:
Like I say, it all works fine except for the control source.
Incidentally, what if I wanted to add code to each checkbox's change event - is this possible by adding something to this code? So If I already had a sub with the code I wanted to execute, could I add change event code to the checkbox I just made?
Thank you for anyone who can help with all this - I think you ROCK!
James
I have a userform which gets populated by checkboxes on the fly. For each cel in a list on a sheet, a checkbox is made. I am trying to get the control source for each checkbox to be the cell in the next column to the current cel selected. Unfortunatley, the controlsource just isn't working in the code I have written. Here's my code:
Code:
for each cel in offices
set mylabel = userform1.controls.add("Forms.label.1")
mylabel.caption = cel.value
Set myCB = userform1.controls.add("forms.checkbox.1")
myCB. controlsource= cel.offset(0,1)
Like I say, it all works fine except for the control source.
Incidentally, what if I wanted to add code to each checkbox's change event - is this possible by adding something to this code? So If I already had a sub with the code I wanted to execute, could I add change event code to the checkbox I just made?
Thank you for anyone who can help with all this - I think you ROCK!
James