ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating a pivot table from different sets of data using a macro (https://www.excelbanter.com/excel-programming/283271-creating-pivot-table-different-sets-data-using-macro.html)

Éidhne in Ireland

Creating a pivot table from different sets of data using a macro
 
Hi,

I'm trying to create a pivot table from an external text
file using a macro. The data always has the same number
of colums (12), but the number of rows varies. This is a
problem - when I record the original macro the data range
for the pivot table is stored in it. When I try to run the
same macro on a data set with a larger number of rows, all
data after the final row indicated by the original data
set is ignored.

Any suggestions greatly appreciated.

Thanks in advance......

Tom Ogilvy

Creating a pivot table from different sets of data using a macro
 
instead of
worksheets("Sheet1").Range("A1:Z200")

use

Worksheets("Sheet1").Range("A1").CurrentRegion

--
Regards,
Tom Ogilvy

"Éidhne in Ireland" wrote in message
...
Hi,

I'm trying to create a pivot table from an external text
file using a macro. The data always has the same number
of colums (12), but the number of rows varies. This is a
problem - when I record the original macro the data range
for the pivot table is stored in it. When I try to run the
same macro on a data set with a larger number of rows, all
data after the final row indicated by the original data
set is ignored.

Any suggestions greatly appreciated.

Thanks in advance......





All times are GMT +1. The time now is 01:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com