Filter Data based on Cell Value (Cell Value is formula referencing value on another sheet)

LONeill13

Board Regular
Joined
Feb 12, 2013
Messages
135
Hello:

I'm trying to create a macro - which I can then assign to a button - so that all the end user needs to do is press the button in the file and the data will automatically filter based on value in cell A1.

Sheet 1 is a data entry sheet for end user. Cell A29 is a formula based on a which checkbox is selected. Sheet 2 has a list of products. In cell A1 of this sheet I have a formula referencing cell A29 of Sheet1. What I want to do is filter the data on Sheet2/column C, based on the results reflected in cell A1.

I've recorded the macro, but I'm thinking that I need to tweak the Criteria1 to look at cell A1 as Value. Can someone please help?!

Code:
Sub Macro1()
'
' Macro1 Macro
'

'
    Sheets("Quill_Micro codes").Select
    ActiveSheet.Range("$A$3:$D$213").AutoFilter Field:=3, Criteria1:=Val(Range("A1"))
End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Code:
Sub Macro1()


Criteria = Sheets("Quill_Micro codes").Range("A1").value

Sheets("Quill_Micro codes").Range("$A$3:$D$213").AutoFilter Field:=3, Criteria1:= Criteria
End Sub

Does that help?

FarmerScott
 
Upvote 0

Forum statistics

Threads
1,214,529
Messages
6,120,070
Members
448,943
Latest member
sharmarick

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