[COLOR=darkblue]Option[/COLOR] [COLOR=darkblue]Explicit[/COLOR]
[COLOR=darkblue]Private[/COLOR] [COLOR=darkblue]Sub[/COLOR] Worksheet_PivotTableUpdate([COLOR=darkblue]ByVal[/COLOR] Target [COLOR=darkblue]As[/COLOR] PivotTable)
[COLOR=darkblue]Dim[/COLOR] pt [COLOR=darkblue]As[/COLOR] PivotTable
[COLOR=darkblue]Dim[/COLOR] pf [COLOR=darkblue]As[/COLOR] PivotField
[COLOR=darkblue]Dim[/COLOR] pi [COLOR=darkblue]As[/COLOR] PivotItem
[COLOR=darkblue]Dim[/COLOR] Pos [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
[COLOR=darkblue]Set[/COLOR] pt = Target
[COLOR=darkblue]On[/COLOR] [COLOR=darkblue]Error[/COLOR] [COLOR=darkblue]Resume[/COLOR] [COLOR=darkblue]Next[/COLOR]
[COLOR=darkblue]Set[/COLOR] pf = pt.PivotFields("Date")
[COLOR=darkblue]On[/COLOR] [COLOR=darkblue]Error[/COLOR] [COLOR=darkblue]GoTo[/COLOR] 0
[COLOR=darkblue]If[/COLOR] pf [COLOR=darkblue]Is[/COLOR] [COLOR=darkblue]Nothing[/COLOR] [COLOR=darkblue]Then[/COLOR] [COLOR=darkblue]Exit[/COLOR] [COLOR=darkblue]Sub[/COLOR]
[COLOR=darkblue]If[/COLOR] pf.Orientation = xlHidden [COLOR=darkblue]Then[/COLOR] [COLOR=darkblue]Exit[/COLOR] [COLOR=darkblue]Sub[/COLOR]
[COLOR=darkblue]With[/COLOR] Application
.EnableEvents = [COLOR=darkblue]False[/COLOR]
.ScreenUpdating = [COLOR=darkblue]False[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]With[/COLOR]
pt.ManualUpdate = [COLOR=darkblue]True[/COLOR]
[COLOR=darkblue]For[/COLOR] [COLOR=darkblue]Each[/COLOR] pi [COLOR=darkblue]In[/COLOR] pf.PivotItems
Pos = InStr(pi.Caption, "-")
[COLOR=darkblue]If[/COLOR] Pos > 0 [COLOR=darkblue]Then[/COLOR]
pi.Caption = Trim(Left(pi.Caption, Pos - 1))
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
[COLOR=darkblue]Next[/COLOR] pi
pt.ManualUpdate = [COLOR=darkblue]False[/COLOR]
[COLOR=darkblue]With[/COLOR] Application
.ScreenUpdating = [COLOR=darkblue]True[/COLOR]
.EnableEvents = [COLOR=darkblue]True[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]With[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]