Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtotal array for groups/columns Just won't work?

Status
Not open for further replies.

johnod33

Programmer
Mar 17, 2003
34
US
I have spent hours and hours trying it get this to work.
searching here and on the Internet.
I have found the same code over and over but it just doesn't work.

Here goes:
Column A in Excel table is Country
Column G is sales for Country by customer (Actually several columns need to be subtotaled. G and H are example here.)
I want to subtotal G and H on Country (column A)

#DEFINE True .T.
#DEFINE False .F.
#DEFINE xlSum -4157

local array subarray(2)
subarray(1) = 7
subarray(2) = 8

oExcel = CREATEOBJECT ("Excel.Application")
WITH oExcel
.Selection.Subtotal(1,xlSum,&subarray,.T.,.F.,T)
ENDWITH

I have tried DIMENSION subarray(2)
I have tried COMARRAY(oExcel,11) (one based array)

If I use:
.Selection.Subtotal(1,xlSum,7,.T.,.F.,T)
it works fine for 7th column or G.
I just can't get an ARRAY to work.

I keep getting the error MISSING OPERAND
If I removed the & before subarray it will subtotal the last number in the array in this case 8

Any help would be appreciated.

John O'D


 
Never mind,
I am an idiot.

I have been using &array instead of @array.
:-(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top