I have a program that assembles data one line at a time by user input via a userform. Some of the lines are what I call "Header" lines and need to show the sum of what I call "Detail" lines below them. See the following image as a simplified example:
When a user adds a detail line, I need the header to reflect the sum of the detail lines below it until the next header line. I have the following vba in solution in mind:
Basically, since only the header line will ever have data in column A I am thinking I can use that to loop through and add some kind of formula to sum only the detail corresponding to the header. Maybe it is not a formula but just more code that can accomplish this. Either way, I would really appreciate some help if you are able to. Thanks!
When a user adds a detail line, I need the header to reflect the sum of the detail lines below it until the next header line. I have the following vba in solution in mind:
VBA Code:
Set rng = Worksheets("GL Import Data Batches").Range("A1:A100")
For Each cell In rng
If cell.Value <> "" Then cell.Offset(0, 2).Formula = "THIS IS WHERE I NEED HELP"
Next cell