vba - Making excel graphs appear/disappear -
i want graph appear when condition fulfilled. more precise: have drop down menu changes content of graph. if menu point "total revenue" clicked, want second graph appear. new vba , came far:
sub iffuntion() dim selectedchart range dim notvisible boolean if range("d100").value = range("e100").value activesheet.chartobjects("testchart").visible = true else activesheet.chartobjects("testchart").visible = notvisible end if end sub
it works, have execute vba make graph appear/disappear , happen automatically. condition should in worksheet keep sheet graphs nice , tidy. read achieve have toi have activate other worksheet. recommend way or there better solution?
thanks , best regards! pete
edit: here link sample file proposed solution of cor_blimey, couldn't work properly. interconnections in excel more complicated have be, wanted accurate ad possible in displaying happening in excel. taking look!
assuming mean change, data validation drop down list, contents of cell can put code worksheet's worksheet_change event. event fired when user changes content of cell (or external link).
then test cell being right cell run code.
like:
private sub worksheet_change(byval target range) dim rng range set rng = intersect(target, me.range("d100")) if not rng nothing if rng.value = me.range("e100").value me.chartobjects("testchart").visible = true else me.chartobjects("testchart").visible = false end if end if end sub
Comments
Post a Comment