Written by Allen Wyatt (last updated March 7, 2026)
This tip applies to Excel 97, 2000, 2002, and 2003
A common task done in macros is to lock and unlock different cells and objects in a workbook. This is often done for protection reasons, so that things cannot be modified inadvertently by users. If you need to unlock the charts that are in your workbook, you can easily do so if you remember that even though charts can be considered drawing objects, you don't unlock them as drawing objects--you specifically unlock the chart object.
In addition, how you unlock a chart depends on whether it is a Chart sheet or a Chart object on a regular worksheet. The following code, named ChartUnProtect, provides an example of how to successfully unprotect both types of charts.
Sub ChartUnProtect()
Dim wks As Worksheet
Dim cht As Chart
Dim chtObj As ChartObject
Dim PW As String
PW = "mypass"
'Unprotect all Chart sheets
For Each cht In ActiveWorkbook.Charts
Sheets(cht.Name).Unprotect password:=PW
Next
'Unlock all Chart objects on each worksheet
For Each wks In ActiveWorkbook.Worksheets
wks.Unprotect password:=PW
For Each chtObj In wks.ChartObjects
wks.DrawingObjects(chtObj.Name).Locked = False
Next
wks.Protect password:=PW
Next
End Sub
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2264) applies to Microsoft Excel 97, 2000, 2002, and 2003.
Dive Deep into Macros! Make Excel do things you thought were impossible, discover techniques you won't find anywhere else, and create powerful automated reports. Bill Jelen and Tracy Syrstad help you instantly visualize information to make it actionable. You’ll find step-by-step instructions, real-world case studies, and 50 workbooks packed with examples and solutions. Check out Microsoft Excel 2019 VBA and Macros today!
Excel allows you to add two distinct types of charts to your workbooks: embedded or chart sheets. You can switch between ...
Discover MorePie charts are a great way to graphically display some types of data. Displaying negative values is not so great in pie ...
Discover MoreWhen creating charts that will be used by other people, you may need to take some liberties with the presentation of your ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2026 Sharon Parq Associates, Inc.
Comments