When I run the code from VBA (pressing F5), it runs perfectly, BUT when I run it from a check box in worksheet, it displays a prompt "the chart is on a protected sheet"? After I click OK, it displays the chart. It works perfectly in other files? Thanks in advance.


[CODE]Sub ChangeChartTypeFuelHistory()
Application.ScreenUpdating = False

Worksheets("Fuel History Chart").Unprotect Password:="1345t"

Dim Cht As ChartObject
For Each Cht In Worksheets("Fuel History Chart").ChartObjects
If Cht.Chart.ChartType = xlLine Then
Cht.Chart.ChartType = xlColumnClustered
Else
With Cht
.Chart.ChartType = xlLine
.Chart.SetElement (msoElementDataLabelTop)
End With
End If
Next Cht

Worksheets("Fuel History Chart").Protect Password:="1345t"

Application.ScreenUpdating = True
End Sub[CODE]