Auto Updating AutoFilter

aje35

New Member
Joined
Jun 22, 2010
Messages
47
I have a product sheet with product names, costs, and quantity. I have a quote sheet that has all the products on it but using an autofilter it only displays products with quantities greater than zero. Unfortunately when I change a quantity value in my source sheet the autofilter needs to be reset to display updated values. I am not familiar at all with macros and am using Microsoft Excel 2008 for Mac. Any help on this matter would be greatly appreciated.
Source Sheet
29geik8.png

Quote Sheet
dzawd0.png
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You have given the data as images and I was not able to copy the data into my sheet to prepare and check the macro. It would be helpful if the data is given as a sheet using htmlmaker given under sticky postings at the top. Otherwise park the data in a webpage like "speedysahre.com" without password.

however I have made a sample workbook with sheet1 having main data and sheet2 in which filtered data is copied
you can modify the macro to change the sheet names if you want to use the macro in your workbook
my sample workbook is in this url called "aje.xls"

http://www.speedyshare.com/files/23282467/aje.xls


I have created a macro in a standard module "filtering"


Code:
Sub filtering()
Dim r As Range, filtr As Range
Worksheets("sheet2").Cells.Clear

 Worksheets("sheet1").Activate
 ActiveSheet.AutoFilterMode = False
Set r = Range("A1").CurrentRegion
r.AutoFilter field:=4, Criteria1:=">0"
r.Cells.SpecialCells(xlCellTypeVisible).Copy
Worksheets("sheet2").Range("A1").PasteSpecial

ActiveSheet.AutoFilterMode = False
Application.CutCopyMode = False
End Sub

Now I rightcicked the sheet1(repat sheet1) tab and clicked viewcode.
in the resulting window I parked this event code

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 4 Then Exit Sub
filtering
End Sub

whenever you change some data in sheet1 column D (only column D) the filtering will be automatically done again and the filtered data will be copied in sheet 2.

your comments please
 
Upvote 0

Forum statistics

Threads
1,215,467
Messages
6,124,984
Members
449,201
Latest member
Lunzwe73

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