Excel VBA: Auto-Filter filtering first column when A2 selected

Bluesguy07

New Member
Joined
Mar 11, 2016
Messages
28
I'm not sure why this is happening, and you guys helped me with this original code... but whenever I run this macro, it is ALWAYS trying to filter the first column when the any cell left of AS1 is selected. I have done some modifications to the original, but can't figure out why it's doing it.

Code:
          'Filters Column AS by QOI-qty = 
redSub FilterColumnAS()
Application.ScreenUpdating = False
    ActiveSheet.Range("AS1").Select
    Selection.AutoFilter
    ActiveSheet.Range("$AS$1:$AY$" & lastr1).AutoFilter Field:=1, Criteria1:=RGB(255, 0 _
    , 0), Operator:=xlFilterCellColor
Application.ScreenUpdating = True
End Sub


Thanks
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I'm not sure why this is happening, and you guys helped me with this original code... but whenever I run this macro, it is ALWAYS trying to filter the first column when the any cell left of AS1 is selected. I have done some modifications to the original, but can't figure out why it's doing it.

Code:
          'Filters Column AS by QOI-qty = 
redSub FilterColumnAS()
Application.ScreenUpdating = False
    ActiveSheet.Range("AS1").Select
    Selection.AutoFilter
    ActiveSheet.Range("$AS$1:$AY$" & lastr1).AutoFilter Field:=1, Criteria1:=RGB(255, 0 _
    , 0), Operator:=xlFilterCellColor
Application.ScreenUpdating = True
End Sub


Thanks

The Field number designates the column within the specified range to filter. If your range is G1:AC500 and the Field designation is 3, then Column I will be the filtered column. Of tje Field designation is 1 then Column G will be the filtered column. So change the Field number to change the column that is filtered.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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