Auto Fillter data and copy to other table

N

Nikolay.V.Petrov

I have a column, which i would like to filter and copy the filtered
data to other sheet.
The filter criteria should be the items in the same column.
Like using the auto filter.
I know how to apply Auto filter - Selection.AutoFilter Field:=1,
Criteria1:="xyz", but how to get this "xyz" from the values in that
column?
Should I loop throght the column cells, and somehow filter the items?
I am lost?

Also when looping throught column, how to stop if cell is empty?

thanks
 
F

funkymonkUK

RANGE(\"A7\").SELECT ' ANY CELL ON THE TOP OF YOUR HEADING
SELECTION.AUTOFILTER ' ADDS AUTO FILTER
SELECTION.AUTOFILTER FIELD:=1, CRITERIA1:=\"XYZ\" ' SELECTS THE
CRITIRIA I.E 1= FIRST COLUMN. XYZ=WHAT YOU WANT TO FILTER IT BY
SELECTION.CURRENTREGION.SELECT ' SELECTS THE RESULTS
SELECTION.COPY ' COPYS THE RESULTS
WORKBOOKS.ADD ' ADDS WORKBOOK
ACTIVESHEET.PASTE ' PASTES THE RESULTS
APPLICATION.CUTCOPYMODE = FALSE ' TURNS OFF THE COPY FEATURE


Hope that helps let me know if you have any questions
 
N

Nikolay.V.Petrov

The problem is that i want to filter it by the contens of the column.

let's say i have the following column
xyz
xyz
xyz
xyz
zyx
zyx
zyx
yxz
yxz
yxz


i would like to filter and copy data for every single item - first for
"xyz", second "zyx", third "yxz",

don't know how to do it
 
F

funkymonkUK

how many different values are there that you want to filter.

it is not to long just copy the copy the amount of times and then you
should be able to paste it in different workbooks or sheets.

I think a "Do Loop" is in needed however I am not sure how to do a loop
with autofilter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top