View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default worksheet function?

Sub AA()
Range("c4").Formula = "=Average(M3:M9)"
Range("C4").AutoFill Destination:=Range("C4:I4"), Type:=xlFillDefault
End Sub

--
Regards,
Tom Ogilvy

"KiriumF1" wrote in message
...
Do to write the below in VBA? I used

Range("C4").Select
Range("c4") = WorksheetFunction.Average(Range("M3:M9"))
Range("C4").Select
Selection.AutoFill Destination:=Range("C4:I4"), Type:=xlFillDefault
Range("C4:I4").Select
-----------------------------
in C4: =AVERAGE(M3:M9)

then copy across to I4



"Tom Ogilvy" wrote:

dblAvg = WorksheetFunction.Average
(Worksheets("Sheet1").Range("C3:C9").Value)

--
Regards,
Tom Ogilvy


"KiriumF1" wrote in message
...
Mm..how to write average worksheet function in VBA?

worksheetfunction.average?

How do I reference to the range of cells in another worksheet? Is it

like
this, WorksheetFunction.Average (Range("fulldata for c1")("C3:C9"))?

Thanks!