question on using average function in macro

S

Suhao He

Hi, all

I have a question on using average function in macro.

I have couple of cells, for example from cells(3.4) to cells(3,55) and
I want to get the averaged value of them. Is there a function I can
directly use in macro?

I found one object WorksheetFunction.Average(Range). How Can I convert
Cells(3,4)~Cells(3,55) to a range value?

Thanks,

Suhao
 
D

Dana DeLouis

... How Can I convert
Cells(3,4)~Cells(3,55) to a range value?

Hi. One way:

Sub Demo()
Dim avr
avr = WorksheetFunction.Average(Range(Cells(3, 4), Cells(3, 55)))
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top