Frage

This is a really complicated problem for a total newbie. I can't give the whole subroutine either. It seems to be working except for the part where I calculate the average. I have used a whole slew of the solutions I found here, though none do what I need them to do.

ave = WorksheetFunction.Average("C" & i, "C" & j, "C" & k, "C" & l, "C" & m, _
            "C" & n, "C" & o)

Where ave is a long, and i - n are integers, calculated based on the value of i.

I just need to take the average of the specified cells and place the result into cell Ei. I can't get the calculation to work (nothing happens, not even an error), so I haven't bothered with placing the result yet. But if I could get help with that too, it would be great.

Thanks!

*Edit - This particular code is throwing me error 1004. But when I used

Range("E" & i) = Worksheet...

It was doing nothing. No results, no errors.

*Edit2 - I have it working now, thanks! Here's the code that works.

ave = WorksheetFunction.Average(Range("C" & i).Value, Range("C" & j).Value, _
                Range("C" & k).Value)
Range("E" & i).Value = ave
War es hilfreich?

Lösung

This worked for me:

ave = WorksheetFunction.Average(Range("C" & i).Value, Range("C" & j).Value,..ect)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top