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 does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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