excel - How to hide shape/chart in VBA? -
i tried find solution on internet, none of them worked situation.
i have following chart , want hide it, don't know how:
dim cht chart sub createpie() arrcolors = array(rgb(183, 212, 117), _ rgb(0, 93, 172)) set cht = sheets("dashboard").shapes.addchart(left:=600, width:=160, top:=290, height:=90).chart cht .setsourcedata source:=sheets("data").range("m5:n6") .charttype = xlpie .chartarea.format.fill.solid .chartarea.format.fill.transparency = 1 .chartarea.border.linestyle = xlnone end cht.seriescollection(1) .points(1).format.fill.forecolor.rgb = arrcolors(0) .points(2).format.fill.forecolor.rgb = arrcolors(1) end cht.visible = xlsheetveryhidden end sub
cht.visible = false
doesn't work either.
deleting option, cht.delete
doesn't work either.
you need modify parent
(the chartobject
) in order hide whole chart. instead of line :
cht.visible = xlsheetveryhidden
modify :
cht.parent.visible = false
Comments
Post a Comment