0

I would like to make the the code below generic so to apply for a nnumber of checkboxes. Obviously when n = 100, you can't write down 100 identical Subs each one for every checkbox.

Any comments or answers are appreciated!

Private Sub CheckBox1_Click()
 If CheckBox1.Value = True Then
  Range("B7:H7").Font.Strikethrough = True
 Else
  Range("B7:H7").Font.Strikethrough = False
  Range("B7:H7").ClearContents
 End If
End Sub
GunnRos86
  • 41
  • 8
  • Possible duplicate of [Triggering the same Event Handler for multiple combo boxes](http://stackoverflow.com/q/13461991/11683) – GSerg Apr 21 '17 at 12:05
  • May also be helpful: http://stackoverflow.com/q/10224511/11683, http://stackoverflow.com/q/25384623/11683, https://codereview.stackexchange.com/questions/44361/form-controls-single-event-handler-for-multiple-controls-without-sacrifices. – GSerg Apr 21 '17 at 12:06
  • 1
    It looks like you're using Form controls rather than ActiveX so you can create a macro and assign that to all of them. Not clear why you want 100 checkboxes to do the same thing. – Rory Apr 21 '17 at 14:53
  • Hi Rory! No, I am using ActiveX checkboxes, and they are all placed in a specific Column. When the user checks each one of them he is basically confirming something about the data placed in the correspondent row. When unchecks one then the data should be cleared in order the user to introduce fresh one in the same row. As simple as that. – GunnRos86 Apr 21 '17 at 15:45

0 Answers0