David Evans
Active Member
Code:
Dim pt As PivotTable
'Application.ScreenUpdating = False
Sheets("Data for Proformas").Activate
Set pt = ActiveSheet.PivotTables("ClientAccounts")
pt.PivotFields("Account Number").DataRange.Copy
'Selection.Copy
'ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Summary").Select
Range("A9").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Oh and just to confuse things further, if I reset the code and Step Over it, a very similar piece of code following it does not go to the Function thingy ...
Code:
Function SumIntervalCols(WorkRng As Range, interval As Integer) As Double
Dim arr As Variant
Dim total As Double
Dim j As Double
total = 0
arr = WorkRng.Value
For j = interval To UBound(arr, 2) Step interval
If IsNumeric(arr(1, j)) Then total = total + arr(1, j)
Next
SumIntervalCols = total
End Function