Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA - Calculate Average in Range 1

Status
Not open for further replies.

Bass71

MIS
Jun 21, 2001
79
Hi,

I'm trying to write code that will calculate the average of a range and evaluate output in If - Then statement.

Range("P97").Select
If Range(R[-5]C[-4]:R[4]C[-4]).FormulaR1C1.AVERAGE > .65 then...

I realize after the R1C1 the logic disintegrates, but the attempt is evident.

Thanks for your help...........RO



 
Have a look at WorksheetFunction

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Worksheet functions only help within cells. I need to know the syntax behind the scene in VBA that will evaluate the range and make a determination
 
I think you're too quick to discount PH's advice:
WorksheetFunction Property
...
Returns the WorksheetFunction object. Read-only.

Example
This example displays the result of applying the [red]Min[/red] worksheet function to the range A1:A10.

Set myRange = Worksheets("Sheet1").Range("A1:C10")
answer = Application.WorksheetFunction.[red]Min[/red](myRange)
MsgBox answer

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top