I have written code to put "Total Value" 3 rows after the last data on Col A & to sum Col B from B2 to the last row containing data in Col B
I need the above to occur from sheet6 onwards, but "Total Value" is only inserted 3 rows after the last data in Col A of the active sheet and Col B is also only summed on the active sheet
It would be appreciated if someone could kindly amend my code so that "Total Value" is only inserted 3 rows after the last data in Col A and Col B is summed from sheet6 to the last sheet containing data
I need the above to occur from sheet6 onwards, but "Total Value" is only inserted 3 rows after the last data in Col A of the active sheet and Col B is also only summed on the active sheet
It would be appreciated if someone could kindly amend my code so that "Total Value" is only inserted 3 rows after the last data in Col A and Col B is summed from sheet6 to the last sheet containing data
Code:
Sub Totals_Branches()
With Application
.ScreenUpdating = False
.CutCopyMode = False
.Calculation = xlCalculationManual
End With
Dim i As Long
finalrow = Range("A65536").End(xlUp).Row
finalrow = Range("A65536").End(xlUp).Row + 2
For i = 6 To Worksheets.Count
With Sheets(i)
Range("A" & finalrow + 3).Value = "Total Value"
Range("B" & finalrow + 3).Formula = "=sum(B2:B" & finalrow & ")"
End With
Next i
With Application
.ScreenUpdating = True
.CutCopyMode = False
.Calculation = xlCalculationManual
End With
End Sub