Hurrah! I worked a way out myself, and it was more obvious that I expected.
So I will write my solution here in case anyone ever goes looking, but am still interested if there are better ways, or pitfalls to this one.
All I did was put an "On Error Resume Next" before the With command, and it stopped the runtime error.
' Set all the BLANK messages to not show
On Error Resume Next ' stops a runtime error if there are no "blank" lines to hide
With ActiveSheet.PivotTables("SortedTable").PivotFields("Message")
.PivotItems("(blank)").Visible = False
End With
That's good enough for my situation.
Steve
Bookmarks