Hey Excel team,
What am i doing wrong I am using the following code?
The Goal is to have the code read column F(agent) across various sheets and sum up a total on i2.
Agent column name is not specified and will be changing on weekly bases
so will how many rows are populated per sheet per agent.
Error: No error present just returns a 0 instead of total.
What am i doing wrong I am using the following code?
The Goal is to have the code read column F(agent) across various sheets and sum up a total on i2.
Agent column name is not specified and will be changing on weekly bases
so will how many rows are populated per sheet per agent.
Error: No error present just returns a 0 instead of total.
VBA Code:
Sub SumValueAcrossTabs()
Dim i As Integer
Dim ws_num As Integer
Dim ws As Worksheet
Dim SumRg As Range
ws_num = ThisWorkbook.Worksheets.count
For i = 1 To ws_num
ThisWorkbook.Worksheets(i).Activate
Set SumRg = ActiveSheet.Range("F2", Range("F2").End(xlDown))
Range("I2").Value = WorksheetFunction.Sum(SumRg)
Next
End Sub