Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA for EXCEL and Average

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default VBA for EXCEL and Average

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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA for EXCEL and Average

Thanks, but that's still not what I'm looking for, that would return the
average of the same range each time. I'm trying to return the average of
the range I 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.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default VBA for EXCEL and Average

one way:

With UserForm1
On Error Resume Next
.TextBox1.Text = Application.Average(Selection)
If Err Then _
.TextBox1.Text = "Invalid Selection" 'or perhaps zero
On Error GoTo 0
.Show
End With

In article ,
"D.S." wrote:

Thanks, but that's still not what I'm looking for, that would return the
average of the same range each time. I'm trying to return the average of
the range I have selected with my mouse at the time the userform is loaded.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default VBA for EXCEL and Average

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.




  #8   Report Post  
Posted to microsoft.public.excel.programming
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.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A formula to AVERAGE IF but only average a set number of values [email protected] Excel Worksheet Functions 2 January 31st 08 08:28 PM
Find monthly average but have average automatically configured kimbafred Excel Discussion (Misc queries) 2 August 8th 07 12:28 AM
Error Handling #N/A with AVERAGE Function - Average of values in Row Sam via OfficeKB.com Excel Worksheet Functions 13 July 31st 05 03:59 PM
Weighed Average of a weiged average when there are blanks krl - ExcelForums.com Excel Discussion (Misc queries) 1 July 6th 05 07:37 PM
how does one convert text to a formula "average(A:A)" to =average( phshirk Excel Worksheet Functions 4 April 14th 05 01:20 AM


All times are GMT +1. The time now is 12:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"