When to Stop

  • Thread starter Thread starter Keith
  • Start date Start date
K

Keith

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top