View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Angus Angus is offline
external usenet poster
 
Posts: 81
Default Omit page with no data when use "show page"

The pivot table will create worksheets with "@" as worksheet name.

For each page if it is empty, the grand total at pivot table will be zero.

"bhofsetz" wrote:


Is there a particular cell in each worksheet that will always have
content in it?
You could cycle through all the sheets in your workbook and check that
cell. If the cell is empty then you could delete the empty sheet (or
even just hide the empty sheet).

Sub DeleteEmpty()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If IsEmpty(sh.Range("A1")) Then
Application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts = True
End If
Next sh
End Sub

Give this code a try and see if it does what you are after.

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=381176