ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom Function being called when it shouldn't. (https://www.excelbanter.com/excel-programming/321089-re-custom-function-being-called-when-shouldnt.html)

Ron[_28_]

Custom Function being called when it shouldn't.
 
"Tom Ogilvy" wrote in news:ekHNUzX$EHA.3924
@TK2MSFTNGP15.phx.gbl:

If any values that the formula is dependent on change, then it will
recalculate.




Hi Tom,

I'm running code in a seperate worksheet with no [that I can see]
references to the function at all, yet various pieces of small and simple
code are calling this function and trying to run it on the active cell.

Here's the simple code that's the second piece to [unwantedly] call this
function.

Sub ChangeZeros()
Range("a12").Select
Do Until Selection.Value = "end"
ActiveCell.Offset(1, 0).Select
If ActiveCell.Offset(0, 3).Value = 0 Then
ActiveCell.Offset(0, 3).Value = 1
End If
Loop
End Sub

When I get to the first cell that actually has a zero to be changed to 1 it
calls the function.

I'm at a loss as to why.

Ron

Tom Ogilvy

Custom Function being called when it shouldn't.
 
My guess would be that one of the cells that your function depends on has
some dependency on the cell that gets changed to 1.

--
Regards,
Tom Ogilvy

"Ron" wrote in message
10.200...
"Tom Ogilvy" wrote in news:ekHNUzX$EHA.3924
@TK2MSFTNGP15.phx.gbl:

If any values that the formula is dependent on change, then it will
recalculate.




Hi Tom,

I'm running code in a seperate worksheet with no [that I can see]
references to the function at all, yet various pieces of small and simple
code are calling this function and trying to run it on the active cell.

Here's the simple code that's the second piece to [unwantedly] call this
function.

Sub ChangeZeros()
Range("a12").Select
Do Until Selection.Value = "end"
ActiveCell.Offset(1, 0).Select
If ActiveCell.Offset(0, 3).Value = 0 Then
ActiveCell.Offset(0, 3).Value = 1
End If
Loop
End Sub

When I get to the first cell that actually has a zero to be changed to 1

it
calls the function.

I'm at a loss as to why.

Ron





All times are GMT +1. The time now is 01:37 AM.

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