Trouble with Average function
Hello all,
Does anyone happen to have any ideas as to why the following code does
not work? It is throwing runtime error 1004, Unable to get the average
property of the worksheet funation class.
lastrow = Sheet2.Cells(Rows.Count, 2).End(xlUp).Row
'myavg = Application.WorksheetFunction.Average("b2:b" & lastrow)
'mymax = Application.WorksheetFunction.max("b2:b" & lastrow)
'mymin = Application.WorksheetFunction.min("b2:b" & lastrow)
I have tried to use the average function on the worksheet and it does
work. The min and the max function also throw the same error.
From what I have read on this site this should be the correct syntax.
Any suggestions would be appreciate.
Thanks in advance,
Terry (stumped) <:)
|