pivot tables external data
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Pivot Tables from external data sources

Pivot Tables from external data sources

resolvedResolved · Low Priority · Version 2007

replyReply Thu 22 Jan 2009, 14:08Delegate Beyers said...

Beyers has attended:
Excel VBA Advanced course

Pivot Tables from external data sources

I want to update the filters on a pivot table in excel 2007 using VBA. The data comes from an external datasource and a drop down is used to pick the value(date, in this case). When I record a macro, the filters value in VBA is referred to as an index/reference number, and an actual value can't be entered by setting the value of the cell in question(VBA doesn't allow it)

Can you think of a way to geet around this? I have tried calculating the number of days difference between a known reference number(for a date) and the date in question, and then just filling in the VBA accordingly, and although this works, it is not guaranteed that all the days will have data, and if there is a day missing, it will have an impact on the index/reference number, rendering this method useless.

Any ideas would be appreciated.

For upcoming training course dates see: Pricing & availability

replyReply Mon 20 Apr 2009, 10:46Trainer Anthony said...

RE: Pivot Tables from external data sources

Hi Beyers. I'm sure there is a way of doing this programmatically, but without seeing the source data and how you've generated the Pivot table it's difficult to advise. It sounds like you are recording macros to capture the application of a filter through a drop drown, and it's the use of the drop down that is forcing the application of a index/reference number. Coding "from the ground up" would get around this. Alternatively, you might bring your external data into a separate worksheet, filter it there and then turn it into a pivot table. Also, if you do stick the data into a separate worksheet, the days missing in the external datasource could be programatically replaced by 0 values, which would give those days an index value and allow you to calculate the number of days difference.

I hope some of this helps!

Anthony

Mon 27 Apr 2009: Automatically marked as resolved.

 

Please browse our web site to find out more about
advanced excel courses and other Microsoft training courses.

Excel tip:

View a unique list

You have a column with hundreds of entries, and you need to see what unique items are entered in it. Select any cell in that column, hold down Alt and press the down arrow: Excel produces an alphabetically-sorted list of unique entries in that column.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard