Autofill

M

Meme

Hi,

I have a table in sheet A with fields
like "plan","user","date","amt". Now I need copy this
table to sheet B with only 2 fields, they'
re "user","date". Plus I want to only copy the records
with user name "Smith" and "Ami". Can anyone tell me how
should I program this in my VB code ? Appreciate any
help.
Thanks

Meme
 
R

Raul

Have you tried using the advanced filter function? You
could use the advanced filter to return only the desired
records and then copy the results to sheet B.

The advanced filter code would be:

Range("B3:E9").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range( _
"H3:H5"), CopyToRange:=Range("J3:K3"),
Unique:=False

Hope this helps,
Raul
 
D

Debra Dalgleish

You're welcome! And if you turn on the macro recorder while filtering,
you'll get most of the code you need to run the filter automatically.
 

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