Error msg: Unable to access Worksheet function
Posted on 2002-03-26
I am writing a function in VBA which needs to find the average of a range of cells.
the range varies, so is passed to my function by another function (which I have tested and works fine).
My function looks like this:
Function AvSqFtbyQ(quart As Integer) As Integer
'calculates the average square footage per quartile
Dim hold As Integer
Dim Rng As String
Rng = GetRangeQ(quart)
hold = Application.WorksheetFunction.Average(Rng)
AvSqFtbyQ = hold
When I test it in the Immediate Window I get error number 1004: "Unable to get the Average property of the Worksheet Function Class."
am I missing a reference library or do I need to install something?
any ideas as to what is going on here?
thanks, I know I've been asking a lot of questions lately!