I, I have this macro that look for a value between 2 numbers in column x and
the interpolate for a given value, the macro is:

Sub inter()
Dim Value
Dim a, P As Integer
Dim XRange As Range
Dim YRange As Range

Value = 5.5 'value given by the user (could be textbox1)
a = 1
Set XRange = Range("a1:a600")
Set YRange = Range("b1:b600")
While a < XRange.Rows.Count
If Value > Cells(a, 1) And Value < Cells(a + 1, 1) Then
P = a
Xs = Array(.Index(XRange.Value2, P, 1), .Index(XRange.Value2, P + 1,
1))
Ys = Array(.Index(YRange.Value2, P, 1), .Index(YRange.Value2, P
+ 1, 1))
Interpolate = .Forecast(Value, Ys, Xs)
MsgBox Interpolate
Else
a = a + 1
End If
Wend
End Sub

I know that those .Index and .Forecast needs a "with" and "end with"
but I don't know what kind of with (I thought With activeworksheet but it
didn't work)
so could someone tell me how to make my macro run????
TIA