tags:

views:

37

answers:

0

I am trying to loop a formula in Column "D" until Column "B" doesn't have any more data.

The formula I am adding to Column "D" is :

IF(ISNUMBER(C5),C5,IF(C5<C4,((OFFSET(C5,2,0)-OFFSET(C5,-1,0))*A5/3+OFFSET(C5,-1,0))
   ,IF(C5<>C6,((OFFSET(C5,1,0)-OFFSET(C5,-2,0))*(A5/3)+OFFSET(C5,-2,0)),"")))

If someone can help me at what I am doing wrong with the VBA codes I would greatly appreciated. My CODES are the following:

Sub IsNumeric()
    //* first logic: IF(ISNUMBER(C6),C6 *//
    If Application.IsNumber(Range("c5").Value) Then
        Range("d5").Value = Range("C5").Value

    // *second logic: IF(C6<C5,((OFFSET(C6,2,0)-OFFSET(C6,-1,0))*A6/3+OFFSET(C6,-1,0))* //
    ElseIf Range("c6").Value < Range("c5").Value Then
        Range("d6").Value = Range("c6").Offset(2, 0).Value - Range("c6").Offset(-1, 0).Value * (Range("a6").Value / 3) + Range("c6").Offset(-1, 0).Value

    // * third logic: IF(C6<>C7,((OFFSET(C6,1,0)-OFFSET(C6,-2,0))*(A6/3)+OFFSET(C6,-2,0)),""))) * //
    ElseIf Range("c6").Value <> Range("c7").Value Then
        Range("d6").Value = (Range("c6").Offset(1, 0).Select) - Range("c6").Offset(-2, 0).Select * (Range("a6").Select / 3) + Range("c6").Offset(-2, 0).Select

    Else
        Range("d6").Value = ""
    End If
End Sub