i've created 2 macro buttons to insert/remove columns
i want the formula under HOURS to update to include the newly added columns
for the minimum 3 periods the formula looks like this
=SUM((C3-B3);(E3-D3);(G3-F3))
if i press the button to add a period the formula doesn't update to include (I3-H3) period and so on
after some searches i found 2 suggestions
=SUM(INDIRECT("b4:"&ADDRESS(ROW();COLUMN()-1)))
and
=SUM((INDEX(5:5;2):INDEX(5:5;COLUMN()-1)))
but this only sums everything up to COLUMN()-1 and i can't figure out how can i modify them to suit my needs.
i want the period from "from" to "to" to be calculated for each interval and summed so i would get a total of hours worked per day
as a side request. for my VBA code after the creation of 2 columns is there a simpler way to fill them with "FROM" and "TO" than i come up with? (which is basic text inserting but get the job done)
Range("2:2").Find("").Select
ActiveCell.Formula = "FROM"
Range("2:2").Find("").Select
ActiveCell.Formula = "TO"
thanks
Bookmarks