Thanks Sergey - I was really spinning my wheels with trying to use range. selection.specialcells type of approach and breaking down the VB code. I about gave up but then decided to use UT as my life line.
You came through
Thanks ever so much
Gaylen
>
>#DEFINE xlA1 1
>
>lnLastRow = oSheet.UsedRange.Rows.Count
>lnLastCol = oSheet.UsedRange.Columns.Count
>lnSumRow = lnLastRow + 1
>lnFirstRow = 2
>
>FOR lnCol = 1 TO lnLastCol
> lcFirstCell = oSheet.Cells(lnFirstRow,lnCol).Address(.F.,.F.,xlA1)
> lcLastCell = oSheet.Cells(lnLastRow,lnCol).Address(.F.,.F.,xlA1)
> oSheet.Cells(lnSumRow, lnCol).Formula = "=SUM(" + lcFirstCell + ":" + lcLastCell + ")"
>ENDFOR
>
>
>
>
>>How can I get a column total for columns 3 - 12 in a spreadsheet through automation. The number of rows is variable for each spreadsheet, however the columns are constant.
>>
>>I suppose I can calulate the totals and append a record to the table and then the totals will appear as the last entry when I add them to the worksheet. However I was looking for an automation type code.
>>