Tablecloth98
New Member
- Joined
- Nov 15, 2023
- Messages
- 24
- Office Version
- 2021
- Platform
- Windows
I'm trying to filter a column (E) by the values found in a range and to change all visible cells after that search to a new style ("Good"). For some reason it only seems to be picking up the first row in the range when applying the filter.
Does anyone know where I'm going wrong? (I've copied my code underneath)
Dim criteriaRange As Range
Dim criteriaArray As Variant
Set criteriaRange = Workbooks("Workbook.xlsm").Worksheets("Main")_
.Range("E2:E1048576").SpecialCells(xlCellTypeVisible)
criteriaArray = Application.Transpose(criteriaRange.Value)
ThisWorkbook.Sheets("Raw Data").Range("$A$1:$BA$1048576").AutoFilter Field:=5,_ Criteria1:=criteriaArray, Operator:=xlFilterValues, Criteria2:="<>"
ThisWorkbook.Sheets("Raw Data").Range("$A$2:$BA$1048576")_
.SpecialCells(xlCellTypeVisible).Style = "Good"
Does anyone know where I'm going wrong? (I've copied my code underneath)
Dim criteriaRange As Range
Dim criteriaArray As Variant
Set criteriaRange = Workbooks("Workbook.xlsm").Worksheets("Main")_
.Range("E2:E1048576").SpecialCells(xlCellTypeVisible)
criteriaArray = Application.Transpose(criteriaRange.Value)
ThisWorkbook.Sheets("Raw Data").Range("$A$1:$BA$1048576").AutoFilter Field:=5,_ Criteria1:=criteriaArray, Operator:=xlFilterValues, Criteria2:="<>"
ThisWorkbook.Sheets("Raw Data").Range("$A$2:$BA$1048576")_
.SpecialCells(xlCellTypeVisible).Style = "Good"