Hi, I have a combo box with name "DropShift" and Checkbox with name "CheckBoxTrend". When the Check box is selected a chart type changing, everything works correectly. But I would like to add that when Check box is selected ComboBox is disabled. But I'm getting Run time error "object required"
Any help much appreciated!
Code:
Sub CheckBoxTrend_Change()
Dim ws As Worksheet
Set ws = Worksheets("Data")
Dim ws2 As Worksheet
Set ws2 = Worksheets("Dashboard")
If ws2.CheckBoxes("CheckBoxTrend").Value = xlOff Then
ShiftDrop.Enabled = False
ws2.ChartObjects("Chart 17").Activate
ActiveChart.ChartType = xlColumnStacked
With ws.PivotTables("PivotTrend").PivotFields("Shift")
.Orientation = xlColumnField
.Position = 1
End With
End If
If ws2.CheckBoxes("CheckBoxTrend").Value = xlOn Then
ShiftDrop.Enabled = True
ws2.ChartObjects("Chart 17").Activate
ActiveChart.ChartType = xlColumnClustered
With ws.PivotTables("PivotTrend").PivotFields("Shift")
.Orientation = xlPageField
.Position = 1
End With
ActiveChart.SeriesCollection(1).Trendlines.Add
With ActiveChart.SeriesCollection(1).Trendlines(1)
.Border.ColorIndex = 3
.Border.Weight = xlMedium
.Border.LineStyle = xlContinuous
End With
End If
End Sub
Any help much appreciated!