Fairly new to Arrays (im trying to speed up a currently slow workbook that uses ranges)
lets say I start out with a table like this (Located in Range "A1:B5" on my worksheet)
and im trying to filter it to only intact (this is a simplified version of what im trying to do irl), why am I getting a Type Mismatch and my output array highlighting?
Public Sub Manager_Report()
'Declare Variables
Dim main_array As Variant Dim output_array As Variant
'Populate Main Array
main_array = range("A1").CurrentRegion
'Filter the Array for intact
output_array = Filter(main_array, "Intact")
End Sub
Option Explicit
Option Base 1
Sub OutputFilterArray()
Dim INarray
Dim OutArray
Dim OutArrayFinal
Dim I As Long
Dim CNT As Long
Dim N As Integer
INarray = Range("A3:d" & Range("d" & Rows.Count).End(xlUp).Row).Value
CNT = 1
ReDim OutArray(UBound(INarray, 1), UBound(INarray, 2))
For I = 1 To UBound(INarray, 1)
If INarray(I, 1) = "Intact" Then
For N = 1 To UBound(INarray, 2)
OutArray(CNT, N) = INarray(I, N)
Next N
CNT = CNT + 1
End If
Next I
Range("F3").Resize(UBound(OutArray, 1), UBound(OutArray, 2)) = OutArray
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.