hi,
After filtering data, how can i assign these filtered data (visible cell) to an array?
Worksheets("Sheet1").Range("H1").AutoFilter Selection.AutoFilter Field:=2, Criteria1:="none"
hi,
After filtering data, how can i assign these filtered data (visible cell) to an array?
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.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
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
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.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber