**Zeros in an Array.....**
Hi Hotpepper

The code that assigns values to my Array's is listed below.

What I actually are interested in is the index number of

**Vave_abs_diff(i)** at which Vave_abs_diff is zero.

This index number shall I then use to send

**k(i)** back to the sheet.

Hope you or anyone else has some useful ideas.

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False

On Error GoTo Theend

'

Dim input_cell_1 As Single, input_cell_2 As Single

Dim help_var1 As Double, help_var2 As Double

Dim Cal_cell As Double

'

Const k_start_val As Single = 1

Const k_stop_val As Single = 4

Const k_step_val As Single = 0.01

'

Dim k(1 To ((k_stop_val - k_start_val) / k_step_val)) As Single

Dim Vave_abs_diff(1 To ((k_stop_val - k_start_val) / k_step_val)) As Double

Dim i As Integer

'

'

If OptionButton3 = True And Intersect(Target, Range("Input_Cells")) Then

MsgBox "I'm running_option_3"

'

'* Brug formlen for udregning af shape parameteren med parameterne

'A & Vave som kendte. Placer den udregnede størrelse i relativ ref. A1.

'

input_cell_1 = Range("input_cells").Range("b1")

input_cell_2 = Range("input_cells").Range("c1")

'

For i = 1 To ((k_stop_val - k_start_val) / k_step_val)

If i = 1 Then

k(i) = k_start_val

Else

k(i) = k(i - 1) + k_step_val

End If

'

help_var1 = Application.WorksheetFunction.GammaLn(1 + (1 / k(i)))

Cal_cell = input_cell_1 * Exp(help_var1)

Vave_abs_diff(i) = Abs(Cal_cell - input_cell_2)

'

ThisWorkbook.Worksheets("Power_curves").Range("e3:e500"). _

Rows(i).Value = Vave_abs_diff(i)

Next

'

End If

'

Theend:

Application.EnableEvents = True

End Sub

Regards

NCO