Autofilter on Active Cell Content

paulrh

New Member
Joined
Nov 4, 2015
Messages
15
I require a Macro that uses the contents of the current Active Cell as the criteria for the AutoFilter. The criteria will always be the last entry in column A.

I have trawled though every possible solution I can find for the solution but with no success. I do not know why the following does not work. The "ActiveCell" always gets highlighted when the macro fails to run.

Private Sub CommandButton3_Click()
'Select last data entry in column 1
Range("A65536").End(xlUp).Select
' Filteronactivecell Macro
ActiveSheet.Range("$A$2:$Z$12").AutoFilter Field:=1, Criteria1:=ActiveCell.Value
End Sub


I am sure the answer is simple :)
 
Last edited:
A really useful feature for my (any) spreadsheet would be to have a macro that filters on the active (single) cell.

I know this feature is available as a AutoFilter Command in Excel but for my target audience it would be too difficult to get them all to customize their ribbon. To have the macro available on the worksheet would be preferable.

I guess this is a little trickier as now both the Field and Criteria are variables.
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
A really useful feature for my (any) spreadsheet would be to have a macro that filters on the active (single) cell.

I know this feature is available as a AutoFilter Command in Excel but for my target audience it would be too difficult to get them all to customize their ribbon.
No need to customise the ribbons. Right click the cell and choose
Filter -> Filter by Selected Cell's Value
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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