Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Cashflow Graphic

Posted on 2013-11-09
4
Medium Priority
?
264 Views
Last Modified: 2013-11-10
EE Pros,

I have a "very cool" Cashflow Graph that calculates several financial elements.  Presently it's simply a 36 month (fixed) analysis.  I would like to add one feature to it.  When you select the Timeframe, I'd like the graphic to automatically size and calculate based on the selected Timeframe  up to 60 months (e.g. 12 months, 18 months, 36 months, 60 months).  

That's it!

B.
Cashflow-Chart.xlsm
0
Comment
Question by:Bright01
  • 2
4 Comments
 
LVL 6

Expert Comment

by:ButlerTechnology
ID: 39635614
The follow code block may get you going in the right direction...
Public Sub RefreshChart()
Dim Period As Integer
Dim ws As Worksheet

Dim rSet1 As Range
Dim rSet2 As Range
Dim rSet3 As Range
Dim rSet0 As Range

  Period = Range("B3").Value
  Set ws = ActiveSheet
  
  Set rSet1 = Range("F24").Resize(1, Period + 1)
  Set rSet2 = Range("F37").Resize(1, Period + 1)
  Set rSet3 = Range("F38").Resize(1, Period + 1)
  Set rSet0 = Union(rSet1, rSet2, rSet3)
  
  ws.Shapes("Chart 1").Select
  ActiveChart.SetSourceData rSet0
  
End Sub

Open in new window


It will look at cell B3 and adjust the adjust the data set based on the number of months.  It is assuming that the chart is "Chart 1" -- this could be easily adjusted to a more meaningfull name.
Tom

Tom
0
 

Author Comment

by:Bright01
ID: 39636211
Tom,

I put the code in the Spreadsheet and it didn't work.   It is Chart 1, however there is a Chart 2 that also overlays Chart 1 which produces the BEP (Break Even Point) line.  I also disabled "the links" and connected up the right numbers so you can see what changes when you change the Costs/Benefits (C25 - E26).  Can you take a look at the WS and see what I'm doing wrong?

Thank you in advance.

B.
Cashflow-Chartv2.xlsm
0
 
LVL 81

Accepted Solution

by:
byundt earned 2000 total points
ID: 39636443
I don't think that you need VBA to accomplish your chart. Nor do you need that severely annoying second chart overlaid on top of the first. You will need to extend your formulas in rows 24:38 out to column BN if you want to allow up to 5 years.

You can use dynamic named ranges for Months, the red bars and the green bars. I created these using OFFSET formulas like this:
=OFFSET($F$37,0,0,1,$B$3)

I then used the dynamic named ranges in the chart as a series source with a formula like this:
='Name of workbook.xlsm'!Months

To get the vertical bar, I added a two point series. The first point was (BEP month + 1, - investment). The second point was (BEP month + 1, green cash flow at end of term). I put these formulas in cells E50:F51, then added them as an additional series. Having done this, I changed the chart to a combo type, with the BEP series on a scatter chart. Adding 1 month to the BEP month got the vertical bar centered in approximately the right place.
Cashflow-ChartvQ28289807.xlsm
0
 

Author Closing Comment

by:Bright01
ID: 39637044
Outstanding!  That's just what I was looking for!  Simple, extended solution.  Excellent work...."Thank you!".


B.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question