Hi,
I'm Trying to write a public function that is like the solver add-in in excel. The reason I cant use solver is because the solver add-in doesn't automatically recalculate as the values in the cells are changing. My spreadsheet is dynamic and the values are constantly changing.
I have three values. These are in cells A1, A2, and A3. I call these value1, value2 and value3 respectively in the code below. Changing the value in A3 changes A1 but not A2. I would like a function that will give me the value of A3 for which A1-A2=0
here is the code i have tried to write but it obviously isn't working. I'd appreciate any help on this. There is probably some simple loop type function that would do the trick. Please help.
![]()
Public Function solv(value1 As Double, value2 As Double, value3 As Double) As Double Dim diff As Double Dim countr As Integer diff = 0.00000001 countr = 0 While Abs(value1 - value2) > diff countr = countr + 1 Wend solv = value3 End Function
Bookmarks