SighSigh10
New Member
- Joined
- Oct 10, 2022
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hello seeking help for a code I've gathered. So the code below works well if the criteria are on the same sheet as the table. But I'm trying to figure out how the below code works if the criteria are on the different sheet.
The Criteria: 10/8/2022, 10/9/2022, 10/10/2022
Code:
Sub Test ()
Dim iArray As Variant
With Worksheets("FY23 Data")
iArray = Split(Join(Application.Transpose(.Range(.Cells(2, 1), _
.Cells(.Range("A:A").Find(What:="*", LookIn:=xlFormulas, LookAt:=xlPart,_
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row, 1)).Value)))
.Range("B2").AutoFilter Field:=2, Criteria1:=iArray, Operator:=xlFilterValues
End With
End Sub
The Criteria: 10/8/2022, 10/9/2022, 10/10/2022
Code:
Sub Test ()
Dim iArray As Variant
With Worksheets("FY23 Data")
iArray = Split(Join(Application.Transpose(.Range(.Cells(2, 1), _
.Cells(.Range("A:A").Find(What:="*", LookIn:=xlFormulas, LookAt:=xlPart,_
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row, 1)).Value)))
.Range("B2").AutoFilter Field:=2, Criteria1:=iArray, Operator:=xlFilterValues
End With
End Sub