ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   I can only manually update? (https://www.excelbanter.com/excel-programming/335184-i-can-only-manually-update.html)

jclark419[_2_]

I can only manually update?
 

Hey everyone,

Thanks for the help provided me thus far, but now I am having a
differnt problem. The spreadsheet is set up with 4 worksheets. The
first 2 taking input from the user, the third a sheet of constants and
the forth displaying results. On this results page I have a function
set up that compares a value in the column currently active (this being
on the forth sheet still) to a value on the second page. If they are the
same it reads another value from the second page and returns that to
formula.

The problem is when I update the values on the second sheet it does not
update the function value on the forth. I have read about a calculate
subroutine but I can't get that to work.

Any Idea's? Here is the code:


Code:
--------------------

Option Explicit

Public Function eb(additive2 As Integer) As Double

Dim count As Integer

additive2 = Application.ThisWorkbook.Worksheets("Results").Cel ls(6, Application.ActiveCell.Column).Value

eb = 0

count = 6

For count = 6 To 10
If Application.ThisWorkbook.Worksheets("Additive-Flush").Cells(count, 8).Value = additive2 Then
eb = Application.ThisWorkbook.Worksheets("Additive-Flush").Cells(count, 14).Value + eb
Else
eb = eb + 0
End If
Next count

End Function

--------------------


Thank you

~Jason


--
jclark419
------------------------------------------------------------------------
jclark419's Profile: http://www.excelforum.com/member.php...o&userid=25430
View this thread: http://www.excelforum.com/showthread...hreadid=389051


K Dales[_2_]

I can only manually update?
 
Add a line somewhere (after the Dim would be a good place):
Application.Volatile
"Marks a user-defined function as volatile. A volatile function must be
recalculated whenever calculation occurs in any cells on the worksheet. A
nonvolatile function is recalculated only when the input variables change.
This method has no effect if it's not inside a user-defined function used to
calculate a worksheet cell."
Note that there has to be something else on that sheet that calculates in
order for this to take effect.
--
- K Dales


"jclark419" wrote:


Hey everyone,

Thanks for the help provided me thus far, but now I am having a
differnt problem. The spreadsheet is set up with 4 worksheets. The
first 2 taking input from the user, the third a sheet of constants and
the forth displaying results. On this results page I have a function
set up that compares a value in the column currently active (this being
on the forth sheet still) to a value on the second page. If they are the
same it reads another value from the second page and returns that to
formula.

The problem is when I update the values on the second sheet it does not
update the function value on the forth. I have read about a calculate
subroutine but I can't get that to work.

Any Idea's? Here is the code:


Code:
--------------------

Option Explicit

Public Function eb(additive2 As Integer) As Double

Dim count As Integer

additive2 = Application.ThisWorkbook.Worksheets("Results").Cel ls(6, Application.ActiveCell.Column).Value

eb = 0

count = 6

For count = 6 To 10
If Application.ThisWorkbook.Worksheets("Additive-Flush").Cells(count, 8).Value = additive2 Then
eb = Application.ThisWorkbook.Worksheets("Additive-Flush").Cells(count, 14).Value + eb
Else
eb = eb + 0
End If
Next count

End Function

--------------------


Thank you

~Jason


--
jclark419
------------------------------------------------------------------------
jclark419's Profile: http://www.excelforum.com/member.php...o&userid=25430
View this thread: http://www.excelforum.com/showthread...hreadid=389051




All times are GMT +1. The time now is 12:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com