How to hide previous date column using vb script and keep current and future date data as it is in pivot table.
Tried below script but showing error…
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Set pt = ActiveSheet.PivotTables(“PivotTable2”)
Set pf = pt.PivotFields(“Row Labels”)
For Each pi In pf.PivotItems
If pi.Value < Date Then
pi.Visible = False
Else
pi.Visible = True
End If
Next pi
Error
Trust centre macros setting already enabled.
Kindly help me to find error or alternative solution
Anil_G
(Anil Gorthi)
July 30, 2024, 5:56pm
2
@satish.rathi59
As long per error looks like the setting are not enabled
Can you show what settings are enabled?
Also check if the vba object model setting is enabled it is a checkbox below the actual macro always allow setting
Cheers
Already Enabled setting still not working
Anil_G
(Anil Gorthi)
July 30, 2024, 6:08pm
4
@satish.rathi59
If you see the grayed out macro settings it says disabled with notification…the last option is what you need to select…that is when the checkbox takes effect
Please enable it…looks like you have an org wide setting which made it disable by default
Cheers
1 Like
Okay I will check with IT for this…
Thanks for making this understandable to me.
If any other approach it will be better to get fast solution
1 Like
Anil_G
(Anil Gorthi)
July 30, 2024, 6:13pm
6
@satish.rathi59
Glad it helped…
Hoep this resolves
For running macro this is the only way
Cheers
system
(system)
Closed
August 2, 2024, 6:14pm
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.