N
nobbyknownowt
Hi there, hopefully this is simple!! I've asked the same question as the
last entry on my last question but it could get lost t the bottom
there!
I have been given the following code (the solution is
7.51240351575601)
Sub TestiT()
Dim a, b, f, p
a = 1430
b = 1651
f = 7984
p = 600
Debug.Print Find_x(a, b, f, p)
End Sub
Function Find_x(a, b, f, p)
Dim x As Double
Dim t As Double
Dim j As Long
x = 0
t = 1
Do While x t (THIS MAKES A COMPILE ERROR SO I CHANGED TO
COMBINATIONS OF xt,x>t, x<t and x=t )
t = x
x = x + (a + (b - f) * Tan(x) - p * Cos(x)) / _
(f - b + a * Tan(x) - 2 * p * Sin(x))
Loop
Find_x = x
End Function
How do I put this in my workbook?
I have tried pasting it into both the worksheet and a seperate module
and having the formula =find_x(a,b,f,p) in the cell i need the result
but I just get a #value error, when I evaluate the formula I get #NAME
errors for a,b,f,p
By the way values for a,b,f,p are on the sheet with cell references
b2,b3,b4 & b5. If I change a=1430 to a="b2" or a=b2 I still get the
same error.
Have had a look at various resources to find out what I'm doing wrong
here but its difficult with such a wide range of search terms to
enter.
Anybody able to point me in the right direction?
Cheers
Nobby
last entry on my last question but it could get lost t the bottom
there!
I have been given the following code (the solution is
7.51240351575601)
Sub TestiT()
Dim a, b, f, p
a = 1430
b = 1651
f = 7984
p = 600
Debug.Print Find_x(a, b, f, p)
End Sub
Function Find_x(a, b, f, p)
Dim x As Double
Dim t As Double
Dim j As Long
x = 0
t = 1
Do While x t (THIS MAKES A COMPILE ERROR SO I CHANGED TO
COMBINATIONS OF xt,x>t, x<t and x=t )
t = x
x = x + (a + (b - f) * Tan(x) - p * Cos(x)) / _
(f - b + a * Tan(x) - 2 * p * Sin(x))
Loop
Find_x = x
End Function
How do I put this in my workbook?
I have tried pasting it into both the worksheet and a seperate module
and having the formula =find_x(a,b,f,p) in the cell i need the result
but I just get a #value error, when I evaluate the formula I get #NAME
errors for a,b,f,p
By the way values for a,b,f,p are on the sheet with cell references
b2,b3,b4 & b5. If I change a=1430 to a="b2" or a=b2 I still get the
same error.
Have had a look at various resources to find out what I'm doing wrong
here but its difficult with such a wide range of search terms to
enter.
Anybody able to point me in the right direction?
Cheers
Nobby