USE home()+"samples\data\orders" lcXLFile = "c:\temp\myxltest.xls" COPY to (lcXLFile) type xl5 lnRows = reccount() lnCols = fcount() lcFormulaCell = _GetChar(lnCols)+ltrim(str(lnRows+3)) && 1 header + 2 choice oExcel = createobject("excel.application") WITH oExcel .Workbooks.Open(lcXLFile) WITH .ActiveWorkBook.ActiveSheet .Range(lcFormulaCell).Formula = ; "=SUM("+_GetChar(lnCols)+"2:"+; _GetChar(lnCols)+ltrim(str(lnRows+1))+")" && +1 is for we sent also header ENDWITH .visible = .t. ENDWITH * Return A, AA, BC etc noation for nth column FUNCTION _GetChar LPARAMETERS tnColumn && Convert tnvalue to Excel alpha notation IF tnColumn = 0 RETURN "" ENDIF IF tnColumn <= 26 RETURN chr(asc("A")-1+tnColumn) ELSE RETURN _GetChar(int(iif(tnColumn % 26 = 0,tnColumn - 1, tnColumn) / 26)) + ; _GetChar((tnColumn-1)%26+1) ENDIFAlthough R1C1 notation could be used in many properties A1 notation performs better (Personal opinion).