Taking an average of ranges
I am selecting data for various compounds and would like to then take
that data and average it and then put it into a cell. The problem I am
having is that I don't quite know how to average this data. My code is
below and probably outlines it better. Basically I can have multiple
compounds and would like to average the data from each compound
individually and then input that average into a cell (which would
correspond to the specific compound.
Worksheets("Sheet1").Activate
Dim TempGPCR1 As Range
Dim GPCR1data() As String
Dim i As Long
For i = 1 To numCpd1
Worksheets("Sheet1").Activate
Set TempGPCR1 = Application.InputBox("Please Select Data
for Compound " & i, Type:=8)
'Worksheets("Sheet3").Activate
avegpcr = WorksheetFunction.Average(TempGPCR1)
["B"&i+1].Value = avegpcr
Next i
Is it just the way my code is written or is this not easily done?
Another question involves making a calculation and stopping when it
reaches a blank cell. I just want a simple division but the numbers I
will be dividing by one another are on a different sheet than where I
would like the results. Any thoughts on how I can accomplish this?
TIA
Stephen
|