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