hi,
After filtering data, how can i assign these filtered data (visible cell) to an array?
Code:Worksheets("Sheet1").Range("H1").AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="none"
Printable View
hi,
After filtering data, how can i assign these filtered data (visible cell) to an array?
Code:Worksheets("Sheet1").Range("H1").AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="none"
I don't think you can automatically do this. The visible range will consist of many range areas, and if you set an array to this range it will only pick up the first area.
dear xld,
many thanks for your advice.
Now i know why i kept getting error messages for the whole day.
I adopt another method which is now working for me :)
Code:For i = 2 To RowCount
If Cells(i, 8).Value = "none" Then
arraySize = arraySize + 1
End If
Next i
ReDim myArray(arraySize - 1) As Variant
n = 0
For i = 2 To RowCount
If Cells(i, 8).Value = "none" Then
myArray(n) = Cells(i, 6).Value
n = n + 1
End If
Next i
FilteredData = myArray
I think that is how I would probably do it.