Calcualting values from different worksheets

creyn

Board Regular
Joined
Sep 16, 2016
Messages
127
I am trying to calculate values from two different worksheets onto one sheet. Below is the code I am trying to use. What am I doing wrong?


Range("P2:P2515").AutoFilter field:=16, Criteria1:="=SUBTOTAL(9,P2:P2515)" - Worksheets("ITBM Summary").Range("C26").Value
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try:
Code:
Criteria1:=[SUBTOTAL(9,P2:P2515)] - Worksheets("ITBM Summary").Range("C26").Value
 
Upvote 0
I tried to run this: Criteria1:=[SUBTOTAL(9,P2:P2515)] - Worksheets("ITBM Summary").Range("C26").Value, but it did not work. Can you suggest any other solutions?


Range("P2:P2515").AutoFilter field:=16, Criteria1:="=SUBTOTAL(9,P2:P2515)" - Worksheets("ITBM Summary").Range("C26").Value
 
Upvote 0
I tried to run this: Criteria1:=[SUBTOTAL(9,P2:P2515)] - Worksheets("ITBM Summary").Range("C26").Value, but it did not work. Can you suggest any other solutions?


Range("P2:P2515").AutoFilter field:=16, Criteria1:="=SUBTOTAL(9,P2:P2515)" - Worksheets("ITBM Summary").Range("C26").Value

"it did not work" is not a helpful description for diagnosing the problem. What exactly happened when you tried to run the code? If you got a run time error, what was the error and what line was highlighted when you got it?
 
Upvote 0
I am trying to calculate values from two different worksheets onto one sheet. Below is the code I am trying to use. What am I doing wrong?


Range("P2:P2515").AutoFilter field:=16, Criteria1:=[SUBTOTAL(9,P2:P2515)] - Worksheets("ITBM Summary").Range("C26").Value
 
Upvote 0
I am using this code now: Private Sub CTI()

Range("B1").AutoFilter field:=2, Criteria1:="1001 - North America"
Range("J2").AutoFilter field:=10, Criteria1:="CTI - Non Consumable"
Range("T2").AutoFilter field:=20, Criteria1:="-"
Range("P2517").AutoFilter field:=16, Criteria1:=Worksheets("ITBM Detail").Range("P2516").Value + Worksheets("Exp Current Mo").Range("E26").Value

End Sub


I do not receive an error. The worksheet removes all the values and places a 0("P2517") in the field. Can you help me with what I am doing wrong?
 
Upvote 0

Forum statistics

Threads
1,216,171
Messages
6,129,281
Members
449,498
Latest member
Lee_ray

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