I have a template/tool that I am building that creates a Waterfall chart based on data inputted from one of my employees. The table begins at "A2".
The data in the top table is manually input. The Totals are calculated by the Sum.
The data in the table underneath has formulas in the Values, Totals, Blank, Up and Down columns.
I need the 'Add Feature' button to not only add a column in the top table (and make sure the Total is summing with the new Feature, too). I also need a Row added in the bottom table (above "Product 2"), that follows the same formula rules as the other cells in the table.
At the moment, my 'Add Feature' button only adds a Column to the upper table. It also adds a row to the bottom table, which is good, but when I click it for a second time, it doesn't add a new row.
My current code is as follows:
Sub Add_Feature()
'
' Add_Feature Macro
'
'
Dim lastColumn As Long, lastRow As Long
lastColumn = Cells(2, Columns.Count).End(xlToLeft).Column
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Columns(lastColumn - 1).Select
Range(Selection, Selection).Select
Selection.Copy
Selection.Insert Shift:=xlToRight
Application.CutCopyMode = False
Cells(2, lastColumn).Value = "Feature" & " " & lastColumn - 1
Range(Cells(3, lastColumn), Cells(lastRow, lastColumn)).ClearContents
Cells(1, 1).Select
End Sub
Origina:
Original.JPG
Desired after first click of "Add Feature"
plus1.JPG
Desired after second click of "Add Feature"
plus2.JPG
Formulas
formulas.JPG
Bookmarks