Filtering in VBA

  • Thread starter Thread starter Alan L. Wagoner
  • Start date Start date
A

Alan L. Wagoner

I have a column of values starting in A2, Sheet 1. These values repeat and
are not unique. I want column B2 to have a single occurrence of each cell
in column A.

As an example, here's what I'm looking for:

Sheet1:
Col A Col B
============
brown brown
blue blue
black black
orange orange
black red
black
brown
blue
blue
red
blue

Thanks in advance,

Alan L. Wagoner
 
you know you can use the built in filter function in excel, and then
you wouldnt need to use vba?
 
Yeah, I know, but I need to programmatically create those sheets, because I
have VBA code that will populate them. Right now, I have to manually create
them, and I'd rather have that process automated.
 
Alan,

Very simple using built-in functionality

Columns("A:A").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("B1"), _
Unique:=True

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Bob,

You da Man! May your weekend be filled with fun, joy, and happiness.

Cheers! I owe you a pint.

--Alan
 
Alan L. Wagoner said:
Bob,

You da Man! May your weekend be filled with fun, joy, and happiness.

Cheers! I owe you a pint.

Pint of Director's please!
 

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

Similar Threads


Back
Top