My code below is used to decrements date based on the first date entered, and if column B is filled. As the data imported to Excel is very large, so this calculation is now causing my excel to lag. Is there a way to speed it up??
h
VBA Code:
Private Sub Worksheet_Deactivate()
Dim pf As PivotField
Dim pi As PivotItem
For Each pf In ThisWorkbook.Sheets("Sheet1").PivotTables("PivotTable4").PivotFields
For Each pi In pf.PivotItems
If pi.ShowDetail = True Then
Application.EnableEvents = False
pi.ShowDetail = False
Application.EnableEvents = True
End If
Next pi
Next pf
For Each pf In ThisWorkbook.Sheets("Sheet1").PivotTables("PivotTable2").PivotFields
For Each pi In pf.PivotItems
If pi.ShowDetail = True Then
Application.EnableEvents = False
pi.ShowDetail = False
Application.EnableEvents = True
End If
Next pi
Next pf
End Sub