chris111
09-02-2010, 07:30 AM
Hi,
I'm trying to sum up a series of numbers on the active workbook using the application.worksheetfunction command..
My code is:
Set shares = ActiveWorkbook.Sheets("volume").Range(Cells(i + 1, testseccol), Cells(i + 252, testseccol))
twelvemshares = Application.WorksheetFunction.Sum(shares)
The variables are defined like:
shares as range
i, testseccol as integer
twelvemshares as variant
The values passed into the code are i=1, testseccol=167
The problem is "shares" doesn't get assigned the range, and thus there is nothing to sum.. Can someone help me define this range correctly, or have another idea how to sum these numbers?
I'm trying to sum up a series of numbers on the active workbook using the application.worksheetfunction command..
My code is:
Set shares = ActiveWorkbook.Sheets("volume").Range(Cells(i + 1, testseccol), Cells(i + 252, testseccol))
twelvemshares = Application.WorksheetFunction.Sum(shares)
The variables are defined like:
shares as range
i, testseccol as integer
twelvemshares as variant
The values passed into the code are i=1, testseccol=167
The problem is "shares" doesn't get assigned the range, and thus there is nothing to sum.. Can someone help me define this range correctly, or have another idea how to sum these numbers?