Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Averaging Random Selections?

It took a while but was able to piece other pieces of code together to get to
it. Here it is......i'm sure just one of many possible solutions

Sub average()

Dim i As Long
Dim j As Long
Dim start As Long


i = ActiveCell.Row - 1
start = i

j = ActiveCell.Column

If Cells(i, j).Value = "" Then
Exit Sub
End If

Do While Cells(i, j).Value < ""

i = i - 1

Loop

i = i + 1

Selection.Formula = "=average(" & Cells(i, j).Address & ":" & Cells(start,
j).Address & ")"

End Sub





"Matt R" wrote:

Hi,

Need the syntax to calculate the average of a range of cells and it will
know where to stop the range when it finds a blank cell.
Selection.Formula.....etc... (e.g. Just how the Sum (Sigma) function works
already)

Thanks for your help

Matt R

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
Making random and unique selections from a list Babymech Excel Discussion (Misc queries) 2 January 27th 09 09:39 PM
Random selections Kim Excel Worksheet Functions 2 April 22nd 08 07:09 PM
Non-random numbers generated by excel's data analysis random gener Allie Excel Worksheet Functions 10 September 17th 05 06:19 AM
Random range averaging Steve C Excel Programming 6 September 14th 05 01:01 AM
Non-random numbers generated by excel's data analysis random gener Harlan Grove Excel Discussion (Misc queries) 2 September 13th 05 04:06 PM


All times are GMT +1. The time now is 02:05 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"