ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   finding data within a range (https://www.excelbanter.com/excel-programming/328968-finding-data-within-range.html)

[email protected]

finding data within a range
 
hi,

hi i want to filter out a list od data to much a certain criteria, i
currently use

Selection.AutoFilter Field:=6, Criteria1:=exchange

exchange is a variable, this works fine and it filters ok, but how cn
i copy the filtered data and paste to another part of the sheet.
once the data has been transferred somewhere else i display it in a
userform.

regards

Johny5


Nick Hodge

finding data within a range
 
John

Hopefully this will help. It doesn't contain the code to filter, but you
already have that, but it does define a range (myRng) and then after
filtering, it uses the SpecialCells method to copy the visible cells only
and move them to A1 on sheet2

Sub MoveVisibleCells()
Dim myRng As Range
Set myRng = Range("A2:G6")
myRng.SpecialCells(xlCellTypeVisible).Copy _
Destination:=Worksheets("Sheet2").Range("A1")
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS

wrote in message
oups.com...
hi,

hi i want to filter out a list od data to much a certain criteria, i
currently use

Selection.AutoFilter Field:=6, Criteria1:=exchange

exchange is a variable, this works fine and it filters ok, but how cn
i copy the filtered data and paste to another part of the sheet.
once the data has been transferred somewhere else i display it in a
userform.

regards

Johny5





All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com