Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating totals on last row of spreadsheet
Message
From
07/01/2007 15:44:26
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01183285
Message ID:
01183303
Views:
13
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.
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform