Hi all
apologies for raising a "stupid" question. I am sure this is easy to solve but I do not see a solution myself
I have to create a Sum on columns from column B to J, however I am unable to loop this accordingly. The Sum field is placed below the last active cell in a specific column.
The rows of each created sheet will differ every time that is why I need a dynamic Sum field
I have found a way to sum up single columns but I cannot get this working into a loop:
With Obj1.ActiveSheet
If IsEmpty(.Cells(.Rows.Count, 2)) Then
With .Cells(.Rows.Count, 2).End(xlUp)
.Offset(1, 0).Formula = "=Sum($B$1:" & .Address & ")"
End With
End If
I tried to add a for...next loop with for k = 2 to 10 but I need to have a dynamic value created for "=Sum($B, whereas B needs to be the current active column.
I can do this manually per column but this does not really look nice.
Can anyone help me?
Thanks Patrick
apologies for raising a "stupid" question. I am sure this is easy to solve but I do not see a solution myself
I have to create a Sum on columns from column B to J, however I am unable to loop this accordingly. The Sum field is placed below the last active cell in a specific column.
The rows of each created sheet will differ every time that is why I need a dynamic Sum field
I have found a way to sum up single columns but I cannot get this working into a loop:
With Obj1.ActiveSheet
If IsEmpty(.Cells(.Rows.Count, 2)) Then
With .Cells(.Rows.Count, 2).End(xlUp)
.Offset(1, 0).Formula = "=Sum($B$1:" & .Address & ")"
End With
End If
I tried to add a for...next loop with for k = 2 to 10 but I need to have a dynamic value created for "=Sum($B, whereas B needs to be the current active column.
I can do this manually per column but this does not really look nice.
Can anyone help me?
Thanks Patrick