Autofilter

wittmannm

New Member
Joined
Apr 18, 2002
Messages
10
I have a workbook to keep track of Financial data for my department. Autofilter is turned on, when I change the filter I need the subtotal to change only I am using sumproduct instead of subtotal. Here is the formula =IF(ISBLANK($A$3),SUMPRODUCT(($F$10:$F$472=$F477)*($H$10:$H$472)),SUMPRODUCT(($F$10:$F$472=$F477)*($B$10:$B$472=$A$3)*($H$10:$H$472)))

Cell A3 is to be updated with the new criteria filter, the problem is that cell A3 will not update until I click on the worksheet. Below is my code and everything seems to work except for the updating of cell A3. Can you tell me what I am missing.



Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Changefilters

End Sub

Public Sub Changefilters()
Dim w As Worksheet
Dim filterarray()


Set w = Worksheets("INS fy03")

With w.AutoFilter
With .Filters
For f = 1 To .Count
With .Item(f)
If .On Then
w.Range("A3").Value = .Criteria1
End If
End With
Next
End With

End With

End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
And, I'd suggest changing

=IF(ISBLANK($A$3),SUMPRODUCT(($F$10:$F$472=$F477)*($H$10:$H$472)),SUMPRODUCT(($F$10:$F$472=$F477)*($B$10:$B$472=$A$3)*($H$10:$H$472)))

to

=IF(ISBLANK($A$3),SUMIF($F$10:$F$472,$F477,$H$10:$H$472),SUMPRODUCT(($F$10:$F$472=$F477)*($B$10:$B$472=$A$3)*($H$10:$H$472)))

Aladin
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

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