98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Using sum function in Excel VBA
Using sum function in Excel VBA
Resolved · High Priority · Version 2010
Graham has attended:
Excel VBA Intro Intermediate course
Using sum function in Excel VBA
I am trying to write a formula to sum three cells on one sheet and input the result into another sheet that I am generating for a report. (Very similar structure to teh exercise on the training course - but with a few variations).
I am getting the following error
"Compile error - Invalid qualifier"
The code causing the problem is
Sheets(Office & Dept).Cells(TargetRowCount, 8).Value = _
Application.WorksheetFunction.Sum(Sheets("Rep-Det").Range("a15").Cells(RowCount, 10), Sheets("Rep-Det").Range("a15").Cells(RowCount, 12)).Value
Range ("a15") is effectively an anchor point for the cells to work from - at least that is my intention.
What am I doing wrong?
Regards
Graham
RE: Using sum function in Excel VBA
Hi Graham, thanks for your query. I think there might be a problem at the start:
Sheets(Office & Dept)
...should be
Sheets("Office & Dept")
See if that helps.
Anthony
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Shortcut for accessing recently opened filesTo get into recently opened Excel files without using your mouse, hold down Alt + F to open the File menu. |