Filtering data via VBA code

H

haas786

Hi all! I was wondering if there's a way to program in a filter.
Basically, I have 10 columns...column B contains either of 3 entries:
"Bound", "ANB", or "Declined". I want to be able to program a macro to
filter for any entries containing the word "Bound" in it, and then
copying it and pasting it in another workbook. Then, I want to
"unfilter" it and show all data, and I will copy this and paste in
another workbook. Can this be done via VBA? Thank you in advance!
 
G

Guest

Sure.

Turn on the macro recorder. Select you data and apply an autofilter
(Data=>Filter=>Autofilter). In this column, select custom from the dropdown
and select Contains and type in Bound (or on of your other choices). Then
select all you data and do Edit=>copy. Move to the destination sheet and do
Edit=>Paste (only the visible rows will be copied). go back to the original
sheet and do Data=>Filter=>Autofilter to remove the filter. Turn off the
macro recorder. Look at the recorded code and modify it to suite your
needs.
 
M

merjet

Sure. Turn on the macro recorder. Do your thing. Turn off the macro
recorder. The code will be in the VBE. If you want help modifying the
code, post again.

Hth,
Merjet
 
H

haas786

Sure. Turn on the macro recorder. Do your thing. Turn off the macro
recorder. The code will be in the VBE. If you want help modifying the
code, post again.

Hth,
Merjet

You guys are the greatest! Thank you sooooo much for all your help.
This is among the best resources on the internet - keep up the great
work! Many, many thanks again!
 

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