Loop through columns of excel pivot with vba -
i trying loop through columns of pivottable add conditional formatting. cant figure out how select data of column. able select columnheader. in following code left conditional formatting part away reduce complexity.
sub format_pivot_columns() set pt = activesheet.pivottables("piv_scrapedata") each ptfld in pt.columnfields ptfld.datarange.select selection.interior.color = vbyellow next ptfld end sub
any idea? thanks!
i ended following code works charm. inspiration!
sub format_pivot_columns() set pt = activesheet.pivottables("piv_scrapedata") each ptfld in pt.databodyrange.columns ptfld.select selection.interior.color = vbyellow next ptfld end sub
Comments
Post a Comment