A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi Rick,
Not sure if this is entirely what you want but feel free to get back to me if not.
The following example assigns the visible data to a range variable and then copies the visible data and pastes it to another worksheet.
Sub CopyFilteredData()
Dim rngFilt As Range
With Sheets("Sheet1").AutoFilter.Range
Set rngFilt = .Offset(1, 0) _
.Resize(.Rows.Count - 1) _
.Cells.SpecialCells(xlCellTypeVisible)
End With
rngFilt.Copy Destination:=Sheets("Sheet2").Range("A1")
End Sub
Explanation:
A space and an underscore at the end of a line is a line break in an otherwise single line of code.
Sheets("Sheet1").AutoFilter.Range is the entire AutoFiltered range (Includes both visible and non visible rows)
.Offset(1, 0) moves down one row off the column headers but now includes an extra row at the bottom. (Still includes visible and non visible.)
.Resize(.Rows.Count - 1) removes extra row off bottom created by Offset. (Still includes visible and non visible)
.Cells.SpecialCells(xlCellTypeVisible) restricts to visible cells only.
Note: You cannot iterate through rows in filtered data because it will stop at the first non contiguous row. If you need to do this then please get back to me with an explanation of what you want to do because there is a work around.
Following added with Edit:
Not really sure what you mean by "Once the list has been filtered I want to select the resulting range". I thought you meant the entire filtered visible cells. Further down in your post you seem to be referring to an individual cell which is the first cell of the visible data.
You could replace the Copy/Destination line with the following line to select all of the visible data.
rngFilt.Select
Or you could use the following to select just the first cell of the visible data.
rngFilt.Cells(1, 1).Select
Over to you Rick and like I said before, fell free to get back to me.