Saturday, September 20, 2014

vba - Macro for Reapply Filter on Excel 2016

I have a Mac and am running Excel 2016. I have an Excel sheet which is auto-filtered by date.


Until recently, I had a macro saved which allowed me to press Command+Option+n and it would reapply the filter without my having to go Home->Sort&Filter->Reapply Filter.


For some reason, the most recent Office updates deleted the macro and I can't seem to find it again.


I have tried recording a macro, but when I run it, it says: Runtime Error 1004.


The macro itself reads as follows:


Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Option+Cmd+n
'
ExecuteExcel4Macro "()"
With ActiveWorkbook.Worksheets("Leads").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub

Can someone tell me how to get this to work? I update the sheet almost constantly, so having a shortcut to refresh the filters made my life a lot easier!

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...