is there a way to add chart to a protected sheet?

  • Thread starter Thread starter GolfMan
  • Start date Start date
G

GolfMan

I need a macro. if not is it possible to add it to a hidden sheet

Sub Graph()
ActiveSheet.Shapes.AddChart.Select
With ActiveChart
With .Parent
.Top = Range("d3").Top
.Left = Range("d3").Left
.Width = Range("d3:d16").Width
.Height = Range("d3:d16").Height
.Name = "Chart"
End With
.Axes(xlCategory).TickMarkSpacing = 25
.Axes(xlCategory).TickLabels.NumberFormat = "0.00"
.Legend.Delete
.ChartType = xlLine
.SeriesCollection(1).Values = "=Sheet2!b2:b" & lastrow
.SeriesCollection(1).XValues = "='Sheet2'!a2:a" & lastrow
End With
End Sub
 
Hi

Sub Graph()
Sheets("Sheet1").Unprotect Password:="JustMe"
'your code
Sheets("Sheet1").Protect Password:="JustMe"
End Sub

Regards,
Per
 
Hi,

Rather than turn protection on and off set protection with the
UserInterfaceOnly:=True

UserInterfaceOnly Optional Variant True to protect the user interface, but
not macros. If this argument is omitted, protection applies both to macros
and to the user interface.

If this helps, please click the Yes button

Cheers,
Shane Devenshire
 
Back
Top