i have report i'm building contains pivot tables, names of (i.e. pivottable1) referenced explicitly in vba code.
i wanted include formula-based check in workbook pivot table existed (essentially checking user hadn't changed name of table or deleted completely).
i use following work-around check tables exist using name:
=not(iserror(index(indirect("nameoftable"),1,1)))) can suggest similar pivots using native excel functions?
is creation of vba user defined function option? in case i'd suggest
public function existpivot(ptname string) boolean dim ws worksheet, pt pivottable existpivot = false each ws in activeworkbook.worksheets each pt in ws.pivottables if pt.name = ptname existpivot = true exit function end if next pt next ws end function and use in worksheet =existpivot("xxx"), result either true or false
Comments
Post a Comment