Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Function Updates from another sheet

I have the following function on Sheet1. I then go to Sheet2 and
change the one variable, which is the CounterMarker range value. On
Sheet2, I have a linked cell to the result of the calculation. It
reports #VALUE! When CounterMarker's value is changed. I then go
back to the sheet with the function and hit F9 it calculates just fine.

When I step through the code I see that the CounterMarker range is
empty when changed Sheet2, thus giving me the error message.

My question is how can I fix the function such that it can calculate
when I make changes to CounterMarker's value on Sheet2?

Variables:
'Current_Year = 2005 (fixed value)
'Year_First = 2005 (fixed value)
'DepreciationSchedule = 7 (fixed value)
'AmortizationFactors = 0.1429 (fixed value)
'EOFL - 2017 (fixed value)
'CounterMarker = range (value changes)

Function YearlyDepreciation(Current_Year As Double, Year_First As
Double, DepreciationSchedule As Integer _
, AmortizationFactors As Variant, EligibleDepreciation As Variant,
EOFL As Double, CounterMarker As Range) As Variant

Application.Volatile True
Application.Calculate
Dim Rng1 As Range
Dim Rng2 As Range
Dim Rng1Addr As String
Dim Rng2Addr As String
Dim YearDelta As Double
Dim LeftTextSegment1 As String
Dim RightTextSegment1 As String
Dim LeftTextSegment2 As String
Dim RightTextSegment2 As String

Set Rng1 = EligibleDepreciation
Set Rng2 = AmortizationFactors
YearDelta = Current_Year - Year_First

Rng1Addr =
EligibleDepreciation.Offset(-WorksheetFunction.Min(YearDelta,
DepreciationSchedule), 0) _
.Resize(WorksheetFunction.Min(YearDelta + 1,
DepreciationSchedule + 1), 1).Address

Rng2Addr = Rng2.Offset(-WorksheetFunction.Min(YearDelta,
DepreciationSchedule), 0) _
.Resize(WorksheetFunction.Min(YearDelta + 1,
DepreciationSchedule + 1), 1).Address

YearlyDepreciation =
Application.WorksheetFunction.SumProduct(Range(Rng 1Addr),
Range(Rng2Addr))
End Function

Thanks in advance.

Floyd

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
Excel Multiple sheet updates Liz Excel Worksheet Functions 1 September 26th 08 08:50 PM
enter figures in timesheets and it updates a job costing sheet Val New Users to Excel 4 October 16th 07 02:19 PM
How do I create a sheet in Excel that updates itself from other sh Mark Excel Worksheet Functions 6 January 14th 06 10:24 AM
Expiry Date for further updates into Sheet mk Excel Programming 1 July 14th 03 08:42 AM
Expiry Date for further updates into Sheet J.E. McGimpsey Excel Programming 0 July 11th 03 04:43 AM


All times are GMT +1. The time now is 08:36 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"