I'm working in Excel 2010. Having a problem with the Checkbox Control (ActiveX Control) crashing when I use a different Checkbox control name than conventionally assigned. Trying to code actions based on checked or not checked.
Does the naming protocol for Checkboxes require using the "Checkbox#" convention in order to support finding it when coding. Please don't laugh I'm not very technical, so what seems obvious to most is a major blind spot for me. Thank you for your help. I'm not excited about having Checkbox 1 through 100, when a more user friendly name would help my feeble brain.
Here is an example of the exact code under two different control names. The "Checkbox1" works the "CheckboxX" does not.
Private Sub CheckBox1_Click()
If Checkbox1.Value = True Then
Range("P9").Select
Selection.Copy
Range("O9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("O9").Select
Application.CutCopyMode = False
Range("O9").Select
Else
Range("O9").Select
ActiveCell.FormulaR1C1 = ""
Range("O9").Select
End If
End Sub
Private Sub CheckboxX_Click()
If Checkbox1.Value = True Then
Range("P9").Select
Selection.Copy
Range("O9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("O9").Select
Application.CutCopyMode = False
Range("O9").Select
Else
Range("O9").Select
ActiveCell.FormulaR1C1 = ""
Range("O9").Select
End If
End Sub
Aucun commentaire:
Enregistrer un commentaire