Solved

Cashflow Graphic

Posted on 2013-11-09
4
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

615 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