+ Reply to Thread
Results 1 to 2 of 2

Averaging Random Selections?

  1. #1
    Matt R
    Guest

    Averaging Random Selections?

    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

  2. #2
    Matt R
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1