Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Cashflow Graphic

Posted on 2013-11-09
4
Medium Priority
?
261 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 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

721 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