Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Enz Enz is offline
external usenet poster
 
Posts: 21
Default intentional circular reference question

Hello,

I am a novice at intententional circular references...so I have a
question. I currently have the following coded function and I am
passing certain values into the function, and have followed the
execution of the function to see that it executes correctly up to the
point where the function returns the value (in this case 35). This
seems to be working correctly when tracing the variables within the
VBA editor. The problem arises when I return to the Excel sheet
calling the function, the content in the L13 cell then says zero all
the time, even though it seems that the function is correctly
returning 35.

I have a cell L13 that contains the function call of
=DetermineBalanceValue(D13, L13, L$31, 'Core Tasks Used'!$H$7, L$10, L
$11, L$12,$L23), where the values passed in are (35, <<empty first
time, 0,0.18292, 5, 68, 45, 10)

Does someone recommend something I can read, or try perhaps
differently? I have reviewed all references within the Excel group
and have not found this particular case.....

Much appreciated
regards,
Enzo


The function is defined as follows:

Public Function DetermineBalanceValue(lOldValue As Range,
lModifiedValue As Range, lBalanceValue As Range, lPercentValue As
Range, l1Value As Range, l2Value As Range, l3Value As Range, l4Value
As Range) As Integer
'
''''Application.Iteration = True
Dim updatedvalue As Integer
Application.EnableEvents = False
On Error GoTo ws_exit
' Determine the row for the key indicator required
lOld = CInt(lOldValue.Value)
lBalance = CInt(lBalanceValue.Value)
lPercent = lPercentValue.Value
lModified = lModifiedValue.Value
l1 = l1Value.Value
l2 = l2Value.Value
l3 = l3Value.Value
l4 = l4Value.Value

If (IsEmpty(lModified)) Then
'do nothing use original Old value
Else
If (lOld < lModified) Then
' use the already updated value - or it will revert back
to the original values
lOld = lModified
End If
End If

updatedvalue = CInt(Round(lPercent * (l1 + l2 + l3 + l4), 0))
If (lBalance = 0) Then
If (lPercent * (l1 + l2 + l3 + l4) = lOld) Then
DetermineBalanceValue = updatedvalue
Else
DetermineBalanceValue = lOld
End If
Else
If (lPercent * (l1 + l2 + l3 + l4) = lOld) Then
DetermineBalanceValue = lOld
Else
DetermineBalanceValue = updatedvalue
End If
End If

ws_exit:
Application.EnableEvents = True

End Function
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Circular reference EASY question HELP SpecOpBookie Excel Discussion (Misc queries) 1 June 5th 09 08:40 PM
circular reference Sasa Stankovic Excel Worksheet Functions 3 August 18th 08 03:58 PM
circular reference question Georgeh Excel Worksheet Functions 2 February 12th 08 08:30 PM
data tables and intentional circular references Elliot Excel Discussion (Misc queries) 1 August 7th 07 09:22 PM
circular reference when using a UDF Saira Excel Programming 1 September 21st 05 06:39 PM


All times are GMT +1. The time now is 09:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"