View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Glenn Ray[_3_] Glenn Ray[_3_] is offline
external usenet poster
 
Posts: 34
Default Range Manipulation Question

Hopefully, this will give you a start:

Sub Get_Group_Values()
Dim c As Object
Dim rng As Range
'select your range, example:
Range("A2:A15").Select
For Each c In Selection
If c.Value = c.Offset(1, 0).Value Then
'get Col B values, ex B = c.offset(0,1).value
'get col C values, ex C = c.offset(0,2).value
Else
'process your gathered data for that group
End If
Next c
End Sub

-Glenn Ray


" wrote:

Dear All

I have a worksheet with 3 columns (see below). I need to cycle through
the data and for each group of rows with the same value in column 1, I
perform a stepwise linear interpolation to determine the value in Col3
corresponding to a value of 30 in Col2. I have a function set up for
the interpolation, but I am stuck on the code for cycling through the
range? Any help would be much appreciated.

Thanks
Matt

Col1 Col2 Col3
BH-01 14.8 0.08
BH-01 28.5 0.85
BH-01 42.1 2
BH-01 82.4 19
BH-01 100 38.1
BH-02 14.9 0.08
BH-02 24.2 0.85
BH-02 34.7 2
BH-02 50.7 4.75
BH-03 22.4 0.08
BH-03 31.6 0.15
BH-03 41.2 0.25
BH-03 56.4 0.43
BH-03 81.8 0.85