Macro to calculate average of a user-selected range

  • I am going crazy looking for what should be a simple Macro to calculate the average of a user-selected range. What I want to happen is:


    1. User selects a column range.
    2. User runs a macro, which calculates the average of the values in the range and places the result in the cell below the range.


    As requested, I have already posted this question here.


    Thanks for any help,
    Robert

  • Re: Macro to calculate average of a user-selected range


    Try this. :cool:

    Code
    Sub MyAverage()
        With Selection.Offset(Selection.Rows.Count).Resize(1, 1)
            .Value = WorksheetFunction.Average(Selection)
        End With
    End Sub

    Bruce :cool:

  • Re: Macro to calculate average of a user-selected range


    Perfect! My head, and the wall I was banging it against, are extremely grateful.
    Robert

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!