Hi, I have recorded a macro where the end result is a pivot table being produced. The array of cells that the pivot table reads from can vary in size. How can I get around this?
any help much appreciated
Liam
Hi, I have recorded a macro where the end result is a pivot table being produced. The array of cells that the pivot table reads from can vary in size. How can I get around this?
any help much appreciated
Liam
Depending on your sheet set up, you can use CurrentRegion or UsedRange. Look at the VBA help for explanations.
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
Hi
Does the array size vary only in rows, or both rows and columns? Either way, you could create a dynamic named range that will update as the data is added. The pivot could use the named range (only need to create once) and can be refreshed by the macro to incorporate the additional data.
rylo
hi, the array varies in the number of rows. It will be a different spreadsheet and different data each time the macro is run. Just the data format, in this case 3 columns and varying number of rows, will be the same.
Bear in mind I'm inexperienced with VB, although I can usually see where I need to add things into the module.
thanks
Liam
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks