excel - VBA - Changing PivotFields in 2 different pivot tables from cell selection -


code seems work correctly have click twice second pivot table update cell selection (want update in 1 click). thank can provide!!

code: private sub commandbutton1_click()      dim date_from string     dim date_to string     dim pt pivottable     dim field pivotfield     dim newcat string      date_from = cells(9, 2).value     date_to = cells(10, 2).value     set pt = sheet1.pivottables("pivottable2")     set pttwo = sheet3.pivottables("pivottable4")     set field = pt.pivotfields("handling type")     newcat = sheet1.range("b12").value     newnewcat = sheet3.cells(4, 5).value      pt       sheet1.pivottables("pivottable2").pivotfields("pullreport date").clearallfilters     sheet1.pivottables("pivottable2").pivotfields("pullreport date").pivotfilters.add2 _         type:=xldatebetween, value1:=date_from, value2:=date_to     sheet3.pivottables("pivottable4").pivotfields("pullreport date").clearallfilters     sheet3.pivottables("pivottable4").pivotfields("pullreport date").pivotfilters.add2 _         type:=xldatebetween, value1:=date_from, value2:=date_to      field.clearallfilters   field.currentpage = newcat   'pt.refreshtable     end  pttwo      sheet3.pivottables("pivottable4").pivotfields("handling type").clearallfilters         sheet3.pivottables("pivottable4").pivotfields("handling type"). _         currentpage = newnewcat         'pttwo.refreshtable  end  end sub 


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -