View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] k.vanderstarren@gmail.com is offline
external usenet poster
 
Posts: 11
Default PivotTable with No Source Data

Hi All,

I have a workbook that has data on one sheet that is used to feed a
PivotTable on another sheet. I used a dynamic named range to allow the
PivotTable range to grow/shrink without including blank rows. I also
have macros coded to automatically refresh the PivotTable every time
the sheet that it's on is activated.

This setup works beautifully until all of the source data is deleted
(i.e. the only thing left on the sheet with the data is the row with
the column headings). If all of the source data is deleted, I receive
the following message when the PivotTable sheet is activated:

Run-time error '1004': This command requires at least two rows of
source data. You cannot use the command on a selection in only one row.
...."

I understand what the message means (a PivotTable requires more than
one row of data) but can anyone recommend an elegant way to handle this
situation? As the spreadsheet won't be used by me, I'd like the
solution to allow users to enter and remove data freely.

Any assistance would be greatly appreciated.

Thanks!
Kris