Count Column F(Agent) across multiple sheets with a total (i2)

ezzz

New Member
Joined
Jun 10, 2022
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
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.

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
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
here is screen shot of the excel doc
 

Attachments

  • 1229_237_1.png
    1229_237_1.png
    28 KB · Views: 5
Upvote 0

Forum statistics

Threads
1,214,970
Messages
6,122,514
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top