ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   When to Stop (https://www.excelbanter.com/excel-programming/301480-when-stop.html)

Keith[_11_]

When to Stop
 
I have a macro that updates two pivot tables that are side
by side. Next to the tables is a calculated field based
on the two tables. Once the tables have been updated the
column with the calculated field needs to have the
calculation copied down to the bottom of the now longer
pivot tables.

Is there anyway to automate this? I need the copying to
stop at the same row the pivot tables stop.

Tom Ogilvy

When to Stop
 
Assume the formula is in Cell H5
Dim rng as Range, lastRow as Long
set rng = Activesheet.PivotTables(1).TableRange1

lastrow = rng.rows(rng.rows.count).row
Range("H5:H" & lastrow).Formula = Range("H5").formula

--
Regards,
Tom Ogilvy

"Keith" wrote in message
...
I have a macro that updates two pivot tables that are side
by side. Next to the tables is a calculated field based
on the two tables. Once the tables have been updated the
column with the calculated field needs to have the
calculation copied down to the bottom of the now longer
pivot tables.

Is there anyway to automate this? I need the copying to
stop at the same row the pivot tables stop.





All times are GMT +1. The time now is 04:20 PM.

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