View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bill Barclift Bill Barclift is offline
external usenet poster
 
Posts: 23
Default VBA for EXCEL and Average

Maybe what you are looking for is the 'InputBox' method of the Excel
application class, like this:

Set MyRange = Application.InputBox("Select Range", "Select Range", Type:=8)

Using Type 8 will return a range object that you can then apply the Average
function to.


Bill Barclift

"D.S." wrote in message
...
Thanks, but that's still not exactly what I'm looking for. That would
always return the average of a specific range each time the userform is
loaded. What I need is to return the average of any range of cells that I
may have selected with my mouse at the time the userform is loaded.

D.S.

"J.E. McGimpsey" wrote in message
...
One way:

UserForm1.TextBox1.Text = Application.Average(Range("A1:A100"))

In article ,
"D.S." wrote:

Can VBA code be used to return the average of a worksheet selection?

I'd
like to code a userform textbox to return this average.

D.S.