I need help with the following wonder if anyone knows what i can do to resolve the problem.
The following will be a userform of how i want it to look like.

What i'm trying to do is to select this test1 that will link with a pivot table where selecting it, will also select test1 on pivot table. Then, I will need to write the name "test1" into another worksheet, called it Sheet2. I'm able to write out a code to do this, but when i try to deselect it, a run time error appears. Was wondering if I need to add in another code for it or there is already an error in my code.
My code:
Private Sub CheckBox2_Click() If CheckBox2.Value = True Then Sheets("Sheet1").Select With ActiveSheet.PivotTables("PivotTable1").PivotFields("Test1") .Orientation = xlColumnField .Position = 1 End With ActiveSheet.PivotTables("PivotTable1").PivotFields("Test1").Subtotals = Array( _ False, False, False, False, False, False, False, False, False, False, False, False) Sheets("Sheet2").Select Range("A1").Select ActiveCell.FormulaR1C1 = "Test1" Sheets("Sheet1").Select End If If CheckBox2.Value = False Then ActiveSheet.PivotTables("PivotTable1").PivotFields("Test1").Orientation = _ xlHidden Sheets("Sheet2").Select Range("A1").Select ActiveCell.FormulaR1C1 = "" End If End Sub