View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default how to average a varying amount ou numbers

Warren,

Perhaps?

Activecell.Formula = "=AVERAGE(" & Range(Cells(3, 4), Cells(11, 5)).Address
& ")"

or to keep it in VBA:

myAverage = Application.Average(Range(Cells(3, 4), Cells(11, 5)))

HTH,
Bernie
MS Excel MVP


"cuewoz" wrote in
message ...

I want to include some code in a module to average a range of numbers,
the problem is you dont know before hand how many numbers you will
have.
When someone runs the spreadsheet they enter a number which will be the
amount of figures to be averaged out, but I don't know how to use the
active.formula with a Range(Cells(3, 4), Cells(11, 5)).Select
type of command.
Can anyone help?
I know there isn't much to go on but please ask me what else you might
need to know.


Thanks

Warren


--
cuewoz
------------------------------------------------------------------------
cuewoz's Profile:
http://www.excelforum.com/member.php...o&userid=32161
View this thread: http://www.excelforum.com/showthread...hreadid=570900