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

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
 
P

Per Jessen

Hi

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

Regards,
Per
 
S

Shane Devenshire

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top