I have a subroutine that takes any size of data and finds Xbar. Xbar is the average of all the means based upon the rows. So say I have 4 rows of data input it will take the average of each of these then take the average of those averages. It starts with rows from A2 on for my header.

Code:

[VBA]Sub CalcXbar()

Dim r as Range

set r = Activesheet.Range("A1").CurrentRegion

set r = r.offset(1,0).Resize(r.rows.count-1)

msgbox application.Average(r)

End Sub[/VBA]

My question is I want to take this same format and make it find the average of the ranges for my data. So I want it to take the range for each set and then take the average of all these ranges and still be able to do this for any size of data input.

Thanks in advance.