LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default overflow issues...PLEASE HELP!!!

Hi everyone,

I have written a small program that calculates daily compounded interest and
keep having a problem with an overflow error. My interest rate variables get
too big and crash the program. Isn't there a way to limit how big the
numbers get??? Please advise...


Sub interestcalculation()


Dim t As Integer

Dim v_startingprinciple As Double
Dim v_rounddownmultiple As Double
Dim v_actualinterestrate As Single
Dim v_dailyinterest As Single
Dim v_initialprinint As Double
Dim v_accumprinint As Double
Dim v_previoustest As Variant
Dim v_rate As Single
Dim v_remainingdaysinperiod As Double




'NOTES:
'FY2006 = 0.0057
'FY2007 = 0.0107
'FY2008 = 0.0145
'FY2009 = 0.0119

'Manually set variables for execution:
v_startingprinciple = 200
v_rate = 0.000057
v_remainingdaysinperiod = 26


v_rounddownmultiple =
(Application.WorksheetFunction.RoundDown(v_startin gprinciple, -2) / 100)

v_actualinterestrate = v_rounddownmultiple * v_rate

v_dailyinterest = v_startingprinciple * v_actualinterestrate

v_initialprinint = v_startingprinciple + v_dailyinterest


v_accumprinint = 0

For t = 2 To v_remainingdaysinperiod

v_rounddownmultiple =
(Application.WorksheetFunction.RoundDown(v_initial prinint, -2) / 100)

v_actualinterestrate = v_rounddownmultiple *
v_rate

v_dailyinterest = v_initialprinint *
v_actualinterestrate

v_initialprinint = v_initialprinint +
v_dailyinterest



Next t

'select the cell you'd like to output the number in BEFORE you run
the analysis!
ActiveCell.Value = v_initialprinint




End Sub

 
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
Overflow jmdaniel Excel Programming 4 September 5th 06 07:09 PM
Overflow Erik Beck Jensen Excel Programming 2 December 13th 05 10:11 AM
Overflow when translating from C++ HELP!! hunting Excel Programming 6 April 24th 04 08:18 PM
VBA overflow Tom Ogilvy Excel Programming 3 September 2nd 03 09:04 PM
VBA overflow Don Guillett[_4_] Excel Programming 2 September 2nd 03 04:19 PM


All times are GMT +1. The time now is 01:26 PM.

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

About Us

"It's about Microsoft Excel"