>lnLastRow = oExcel.activesheet.UsedRange.Rows.Count >oExcel.activesheet.Cells(lnLastRow+1,1).Formula = '=SUM(cells(1,1):cells(lnLastRow,1)) >>
lnCol = lnLastRow oExcel.ActiveSheet.Cells(lnLastRow+1,1).Formula = '=SUM(A1:' +; IIF(lnCol>26, CHR(Int((lnCol - 1) / 26) + 64), "") + CHR(((lnCol - 1) % 26) + 65) + '1)'