Hello everyone!
I am new at this website. I am currently working for a bank and I have to do loads of Waterfalls so I tought that I could automatize the process.
Based on this website, http://www.contextures.com/excelwaterfallchart.html , I started recording my moves with VBA to get to the same result.
But I encountered two main issues:
1) The columns I tried to insert beween the numbers (5000; -503; ... 2475) and the labels (Start; Jan ... Dec) are not insterted in between those two columns but at the right of the numbers.
2) the Downs and Ups are not calculated and when I click in the cell I find these formulas =-MIN(#REF!;0) and =MAX(#REF!;0) instead of the formulas I wanted (given in the website above).
Thank you so much I mean it
Jasmin
I am new at this website. I am currently working for a bank and I have to do loads of Waterfalls so I tought that I could automatize the process.
Based on this website, http://www.contextures.com/excelwaterfallchart.html , I started recording my moves with VBA to get to the same result.
But I encountered two main issues:
1) The columns I tried to insert beween the numbers (5000; -503; ... 2475) and the labels (Start; Jan ... Dec) are not insterted in between those two columns but at the right of the numbers.
2) the Downs and Ups are not calculated and when I click in the cell I find these formulas =-MIN(#REF!;0) and =MAX(#REF!;0) instead of the formulas I wanted (given in the website above).
Code:
Sub Waterfall()
'
' Waterfall Macro
'
'
Columns("E:E").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("E3").Select
ActiveCell.FormulaR1C1 = "Base"
Range("F3").Select
ActiveCell.FormulaR1C1 = "End"
Range("G3").Select
ActiveCell.FormulaR1C1 = "Down"
Range("H3").Select
ActiveCell.FormulaR1C1 = "Up"
Range("I3").Select
ActiveCell.FormulaR1C1 = "Start"
Range("J3").Select
ActiveCell.FormulaR1C1 = "Net Cash Flow"
Range("E4").Select
ActiveCell.FormulaR1C1 = "2000"
Range("E19").Select
ActiveCell.FormulaR1C1 = "2000"
Range("I5").Select
ActiveCell.FormulaR1C1 = "5000"
Range("H6").Select
ActiveCell.FormulaR1C1 = "=MAX(RC[2],0)"
Range("G6").Select
ActiveCell.FormulaR1C1 = "=-MIN(RC[3],0)"
Range("J18").Select
Selection.Cut
Range("F18").Select
ActiveSheet.Paste
Range("E6").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-1]C,R[-1]C[3]:R[-1]C[4])-RC[2]"
Range("E6").Select
Selection.AutoFill Destination:=Range("E6:E17"), Type:=xlFillDefault
Range("E6:E17").Select
Range("G6").Select
Selection.AutoFill Destination:=Range("G6:G17"), Type:=xlFillDefault
Range("G6:G17").Select
Range("H6").Select
Selection.AutoFill Destination:=Range("H6:H17"), Type:=xlFillDefault
Range("H6:H17").Select
End Sub
Thank you so much I mean it
Jasmin