Hello,
I was wondering if it is possible that the caption of a checkbox can be changed in a loop.
The problem is that i have 12 checkboxes on a form. These checkboxes only can be shown at the moment that other cell on a certain sheet "standaard" are filled. In our example i want to create a loop for range B8:B19. The reference cell where the future name of the checkbox.caption is stored is R8:R19.
Now is there some code that i automaticly can loop the checkbox in reference with the activecell out of range B8:B19
All the checkboxes have the name Chk1, ..2, ..3, until 12
In the future there will be manymore checkboxes added, so for the code it's much easier when it's short and understandable then copy paste these lines over and over.
The code i have is as follows and is be done in de initilize routine.
Code:1: Set std = Worksheets("standaard") 2: std.Visible = xlSheetVisible 3: std.Select 4: Range("b8:b19").Select 5: ActiveCell.Offset(0, 0).Select 6: For I = 1 To 12 7: If ActiveCell <> "" Then 8: ActiveCell.Offset(0, 16).Select 9: Chk1.Caption = ActiveCell.Value 10: Chk1.Enabled = True 11: ActiveCell.Offset(1, -16).Select 12: Else 13: Chk1.Caption = "" 14: Chk1.Enabled = False 15: ActiveCell.Offset(1, 0).Select 16: End If 17: Next




Reply With Quote