SteveG1983
New Member
- Joined
- Mar 24, 2024
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hi,
I'm fairly new to VBA and i'm trying to develop coding which will allow me to filter only the cells coloured 'Green' in the screenshot below, across several columns (conditional formatting determines the cell colour)
I've applied the following Macro/VBA as a test however when I run it, the 'Green' cells don't all appear (can i replace specific column numbers with a range within the 'AutoFilter Field' condition?);
Sub GreenFilter()
'
' GreenFilter Macro
'
ActiveSheet.Range("$e$18:$br$100").AutoFilter Field:=17, Criteria1:=RGB(146 _
, 208, 80), Operator:=xlFilterCellColor
ActiveSheet.Range("$e$18:$br$100").AutoFilter Field:=20, Criteria1:=RGB(146 _
, 208, 80), Operator:=xlFilterCellColor
ActiveSheet.Range("$e$18:$br$100").AutoFilter Field:=23, Criteria1:=RGB(146 _
, 208, 80), Operator:=xlFilterCellColor
ActiveSheet.Range("$e$18:$br$100").AutoFilter Field:=24, Criteria1:=RGB(146 _
, 208, 80), Operator:=xlFilterCellColor
End Sub
If there is anyone with any guidance/advice, it will be greatly appreciate.
Thanks and regards
I'm fairly new to VBA and i'm trying to develop coding which will allow me to filter only the cells coloured 'Green' in the screenshot below, across several columns (conditional formatting determines the cell colour)
I've applied the following Macro/VBA as a test however when I run it, the 'Green' cells don't all appear (can i replace specific column numbers with a range within the 'AutoFilter Field' condition?);
Sub GreenFilter()
'
' GreenFilter Macro
'
ActiveSheet.Range("$e$18:$br$100").AutoFilter Field:=17, Criteria1:=RGB(146 _
, 208, 80), Operator:=xlFilterCellColor
ActiveSheet.Range("$e$18:$br$100").AutoFilter Field:=20, Criteria1:=RGB(146 _
, 208, 80), Operator:=xlFilterCellColor
ActiveSheet.Range("$e$18:$br$100").AutoFilter Field:=23, Criteria1:=RGB(146 _
, 208, 80), Operator:=xlFilterCellColor
ActiveSheet.Range("$e$18:$br$100").AutoFilter Field:=24, Criteria1:=RGB(146 _
, 208, 80), Operator:=xlFilterCellColor
End Sub
If there is anyone with any guidance/advice, it will be greatly appreciate.
Thanks and regards