I am having a problem with some code attached to an OptionButton in Excel. The code is shown below. The problem is that when I run it I get an error at the first Selection.AutoFill line, and I'm not sure what causes the code to break. This code runs fine as a stand-alone macro, but does not function properly when associated with the OptionButton. Any ideas or suggestions would be greatly appreciated.
j
Private Sub OptionButton10_Click()
Sheets("trck-data").Select
ActiveSheet.Range("A4").Select
ActiveCell.FormulaR1C1 = "=R[152]C"
ActiveSheet.Range("A4").Select
Selection.AutoFill Destination:=Range("A4:A16"), Type:=xlFillDefault
ActiveSheet.Range("A4:A16").Select
Selection.AutoFill Destination:=Range("A4:O16"), Type:=xlFillDefault
ActiveSheet.Range("A4:O16").Select
Sheets("trck-all").Select
End Sub
j
Private Sub OptionButton10_Click()
Sheets("trck-data").Select
ActiveSheet.Range("A4").Select
ActiveCell.FormulaR1C1 = "=R[152]C"
ActiveSheet.Range("A4").Select
Selection.AutoFill Destination:=Range("A4:A16"), Type:=xlFillDefault
ActiveSheet.Range("A4:A16").Select
Selection.AutoFill Destination:=Range("A4:O16"), Type:=xlFillDefault
ActiveSheet.Range("A4:O16").Select
Sheets("trck-all").Select
End Sub