Excelpromax123
Board Regular
- Joined
- Sep 2, 2021
- Messages
- 167
- Office Version
- 2010
- Platform
- Windows
I need to filter by array by 2 criteria "A" and "A-*". I have used the code below but it doesn't work. I need to support a spreadsheet I have about 200,000 lines so I can't do it with formulas
VBA Code:
Sub text()
On Error Resume Next
Dim sArr(), dArr(), Dk1 As String, I As Long, K As Long, R As Long, Col As Long
sArr = Range("B5:C15").Value 'input
R = UBound(sArr)
ReDim dArr(1 To R, 1 To 2)
For I = 1 To R
If UCase(sArr(I, 1)) = "A" Or UCase(sArr(I, 1)) = "A-*" Then
K = K + 1
For Col = 1 To 2
dArr(K, Col) = sArr(I, Col)
Next Col
End If
Next I
' OUTPUT
Range("F5:G15").ClearContents
Range("I5").Resize(K, 2) = dArr '
End Sub