Hello,
I'm attempting to take a range of data and filter the fourth column by an array of specific values. Then once filtered, subtotal the visible cells in the 7th column and set a double variable as that subtotal value.
Whatever I'm doing isn't working because the variable when inserted into another worksheet keeps coming in as "0", which I know is not correct. Here is the part of code I think is incorrect. all ranges and variables have already been dim'd.
I'm attempting to take a range of data and filter the fourth column by an array of specific values. Then once filtered, subtotal the visible cells in the 7th column and set a double variable as that subtotal value.
Whatever I'm doing isn't working because the variable when inserted into another worksheet keeps coming in as "0", which I know is not correct. Here is the part of code I think is incorrect. all ranges and variables have already been dim'd.
Code:
Set rng1 = ActiveWorkbook.ActiveSheet.Range("A1").CurrentRegion
With rng1
.AutoFilter
.AutoFilter field:=4, _
Criteria1:=Array("601", "602", "641", "642", "643"), Operator:=xlFilterValues
Set rng2 = .Offset(1, 7).Resize(.Rows.Count - 1, 1).SpecialCells(xlVisible)
dblThroughPut = Application.WorksheetFunction.Subtotal(109, rng2)
End With