PDA

View Full Version : [SOLVED:] Pivot table (data range).



ermis1975
06-19-2005, 01:11 PM
I have make a pivot table with values that I import from a txt file.
Tha problem is that the txt file has different size of rows (each day changes).
When I imports the new data from the txt file, if the rows are different the
pivot table didn;t works. I have to edit the macro and each time I have to
replace the number in range with the nubmer of the last row.


ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"'sheet'!R1C1:R12000C16").CreatePivotTable

How can I select all active rows and cells.... like the fuction CTRL+a

Is there any solution?
Thanks in advance.

acw
06-19-2005, 10:35 PM
Hi

how about


ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"'sheet'!a1:p" & range("a65536").end(xlup).row).CreatePivotTable


Tony

ermis1975
06-20-2005, 12:06 AM
Thanks!!

Brandtrock
06-20-2005, 02:35 PM
Another Method (http://www.vbaexpress.com/kb/getarticle.php?kb_id=496) from the KB.

HTH,