Hi everyone, this i smy first post on this site, I hope someone will be able to help:
I'm trying to create a function to extract data from a filtered sheet, without having to loop through all rows.
I hoped the .SpecialCells(xlCellTypeVisible) would do the job, but it seems only to return the first area.
Here's the first code I tried:
I was hoping that maybe something with the application.index function may work, using stuff I saw in this thread:
But so far, I couldn't manage to get it working.
Any ideas? (not sure if it's event possible...)
Thanks in advance guys!
I'm trying to create a function to extract data from a filtered sheet, without having to loop through all rows.
I hoped the .SpecialCells(xlCellTypeVisible) would do the job, but it seems only to return the first area.
Here's the first code I tried:
Code:
Function GetFilteredData(ByRef Ws As Worksheet) As Variant
Dim I As Integer
Dim J As Integer
With Ws
I = .Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
J = .Cells.Find("*", [A1], , , xlByColumns, xlPrevious).Column
GetFilteredData = .Range(.Cells(1, 1), .Cells(I, J)).SpecialCells(xlCellTypeVisible)
End With
End Function
I was hoping that maybe something with the application.index function may work, using stuff I saw in this thread:
HTML:
http://www.mrexcel.com/forum/excel-questions/564473-transfer-multiple-ranges-one-array.html
But so far, I couldn't manage to get it working.
Any ideas? (not sure if it's event possible...)
Thanks in advance guys!