I've a single pivot table whose ID is CH577 ("ANALISI MARGINE") and I have some buttons that open it. The tab has many different columns and I want to order it by pressing buttons. So for example if I press button 1 it will sort my tab for column 1, if I press button 2 it will sort my tab for column 2 ecc.
Is there any macro I could use or something like that?
Because I've tried this macro:
Set ch = ActiveDocument.GetSheetObject("CH577") ch.SortBy 17 End Sub
But when I press the button it opens the tab but it doesn't run the macro, instead it opens Edit Module