All pastes #343063 Raw Edit

Something

public text v1 · immutable
·published 2007-02-06 19:29 UTC
rendered paste body

Function newt(ByVal x As Double) As Double

    Dim c As Double
    Dim a As Double
    Dim xn As Double
    Dim d As Double
    Dim b As Double
    xn = x
    c = ((xn) - ((Tan(xn) - (xn) - t) / ((1 / Cos(xn)) ^ 2 - 1)))
    
    a = c
    xn = c
    d = ((xn) - ((Tan(xn) - (xn) - t) / ((1 / Cos(xn)) ^ 2 - 1)))
    b = d
    xn = d
    
    If a = b Then
        newt = xn
    ElseIf a <> b Then
        newt = newt(xn)
    End If
    
    
End Function



Private Sub Worksheet_Change(ByVal Target As Range)



Application.EnableEvents = False
On Error GoTo ErrorHandler


If Target.Column = 1 Then
    Cells(Target.Row, 2) = (((Target - 32) / 9) * 5)
ElseIf Target.Column = 2 Then
    Cells(Target.Row, 1) = (((Target * 9) / 5) + 32)
ElseIf Target.Column = 3 Then
    Cells(Target.Row, 4) = (Target * 2.54)
ElseIf Target.Column = 4 Then
    Cells(Target.Row, 3) = (Target * 0.393700787)
ElseIf Target.Column = 5 Then
    Cells(Target.Row, 6) = (Target * 3.7854118)
ElseIf Target.Column = 6 Then
    Cells(Target.Row, 5) = (Target * 0.264172051)
ElseIf Target.Column = 7 Then
    Cells(Target.Row, 8) = (Tan(Target) - Target)
ElseIf Target.Column = 8 Then
    Cells(Target.Row, 7) = newt(Target)
End If


   
    
'ElseIf Target.Address = "$B$1" Then
'    Range("A1") = (((Range("B1") * 9) / 5) + 32)
'End If

ErrorHandler:
    Application.EnableEvents = True
    


End Sub