Solved

Cashflow Graphic

Posted on 2013-11-09
4
222 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
Comment Utility
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
Comment Utility
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 80

Accepted Solution

by:
byundt earned 500 total points
Comment Utility
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
Comment Utility
Outstanding!  That's just what I was looking for!  Simple, extended solution.  Excellent work...."Thank you!".


B.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now