Macro to extend a pivot table range

  • Thread starter Thread starter Phil Platt
  • Start date Start date
P

Phil Platt

Evening all!

I have a worksheet that uses an ODBC link to create a table. The table
gets longer each time it's refreshed, but it's width stays the same.

I also have a pivot table based on this worksheet.

What I need is a macro that updates my pivot table to include the
extended range of the table.

I've tried naming the input range, then using a macro to update the
extent of the range and using that to update the pivot, but it never
works. If I look at the new range, the "refers to" panel always says
=TRUE - which is meaningless to me!

What I need is a routine that updates a named range called
"sourcedata" on a worksheet called "Input", and feeds it back to a
pivot table on a worksheet called "Analysis".

The data on the "Input" worksheet will always start in A8, and never
extends past column Y. However the number of rows increases every time
the ODBC link is refreshed.

Any help is very gratefully received!!!

Thanks,

Phil
 
You can create a pivot table based directly on an ODBC query (at least you can in XL2000). Just select External Data Source in the first dialog box that the wizard presents.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top