Hi,
I want to use Excel function "Subtotal" from Navision, but problem is here:
When i write
sheet.range('A9:U18').subtotal(4,-4157,'6'); all work properly. column F have a subtotals.
But I need subtotals in columns F & G.
sheet.range('A9:U18').subtotal(4,-4157,'6,7'); doesn't work
as i understand Excel want
ARRAY in parameters
sheet.range('A9:U18').subtotal(4,-4157,ARRAY); Excel macro:
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(5, 6), Replace:=True, PageBreaks:=False, SummaryBelowData:=True
But how do this from Navision...
arr[1]:=5; try arr as Variant,as Integer, as Code arr[2]:=6;
sheet.range('A9:U18').subtotal(4,-4157,arr); - nothing....
:evil:
Is anybody can help?
Comments
Has anyone an example how to use it in Navision, with a subtotal on more than one column ?
sheet.range('A9:U18').subtotal(4,-4157,(6,7));
If somebody know how to do it, let me know.
RowNo is the number of rows from A1, ColumnNo is the same.
x is the SUBTOTAL code, for a sum that code would be the integer 9.
Preceding this code, I put in a for loop to cover as many columns as I want.
So my code (for a spreadsheet with 15 summable columns) looks something like this:
I resolved this issue by generating the array using inline VBScript.
In the following code, the VBScript is of type Automation 'Microsoft Script Control 1.0'.ScriptControl
Tested and works successfully.