My current VBA provides an sum function for pre-defined columns within worksheets which are specified and defined in the code. This works fine, however I am adding new worksheets to this workbook on a daily basis, and its therefore not feasible to edit the code everyday to add a new worksheet and range for it to sum.
Is there a way I can edit my current code in order for it to conduct the sum function for every single worksheet in the workbook? I have attached the current code for reference below.
Sub AutoSum()
Sheets("MASTER ACCOUNT REVENUE").Select
Range("D4").Select
Selection.End(xlDown).Select
ActiveCell.Offset(2, 0).Select
Dim cel1 As String, cel2 As String
cel1 = ActiveCell.Offset(-2, 0).End(xlUp).Address
cel2 = ActiveCell.Offset(-1).Address
ActiveCell.Value = "=sum(" & (cel1) & ":" & (cel2) & ")"
End Sub