How to fit range of calculate calomn to pivot table size in Excel 2013 -
i have pivot table changes row number after each refresh. near (next column), created calculate column not part of pivot table, uses pivot table data.
i have been dragging down last cell calculate column in order fit changing pivot table size calculate values.
is there way fit calculate column pivot table size automatically?
if there way , depends on vba code, there option insert formula , not run macro? thanks.
add routine worksheet code option explicit
enabled @ top.
private sub worksheet_calculate() application.enableevents = false dim calccol string, firstrow long, lastrow long calccol = "a" 'write column name here firstrow = me.pivottables(1).tablerange2.cells(1,1).row lastrow = me.pivottables(1).tablerange2.cells(me.pivottables(1).tablerange2.rows.count,1).row me.range(calccol & firstrow).formula = 'your formula string here me.range(calccol & firstrow & ":" & calccol & lastrow).filldown application.enableevents = true end sub
Comments
Post a Comment