ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sum command in VBA (https://www.excelbanter.com/excel-programming/277458-sum-command-vba.html)

sally

Sum command in VBA
 
I have a xcel spreadsheet that reads data from an Access
database. Since the database determines how many rows
are in the database - I need to programatically create
the totals at the bottom of a column....

something like:
ws.[c19].Offset(iro, i) = SUM(ws.[c19].Offset(0, i):ws.
[c19].Offset(irow,i))

but of course that gives an error .... I know this can't
be that difficult!

Thanks,
Sally

Tom Ogilvy

Sum command in VBA
 
ws.[c19].Offset(iro, i).Formula = "=SUM(" & _
ws.Range(ws.[c19].Offset(0, i),ws.[c19].Offset(irow,i).Address
& ")"

--
Regards,
Tom Ogilvy

sally wrote in message
...
I have a xcel spreadsheet that reads data from an Access
database. Since the database determines how many rows
are in the database - I need to programatically create
the totals at the bottom of a column....

something like:
ws.[c19].Offset(iro, i) = SUM(ws.[c19].Offset(0, i):ws.
[c19].Offset(irow,i))

but of course that gives an error .... I know this can't
be that difficult!

Thanks,
Sally





All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com