Create list with macro

D

David T

I have a list of items in column A and I need to create a drop down list in
column B that excludes any duplicate data. Does anyone have a macro that
can do this?

Column A Column B
apple {drop down list inserted here}
pears
orange
apple
orange
 
L

L. Howard Kittle

Select the list > Data > Filter > Advanced Filter > Copy to another range >
Copy to > 'click destionation cell" >OK

HTH
Regards,
Howard
 
D

Don Guillett

Sub MakeUnique()'put a header in row 1
With Range("M1:M" & Cells(Rows.Count, "m").End(xlUp).Row)
.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
.Copy Range("n1")
ActiveSheet.ShowAllData
End With
End Sub
 
D

David T

Sweet! you are the man! It worked beautfully....

Don Guillett said:
Sub MakeUnique()'put a header in row 1
With Range("M1:M" & Cells(Rows.Count, "m").End(xlUp).Row)
.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
.Copy Range("n1")
ActiveSheet.ShowAllData
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 
D

David T

Don-

If i wanted the put the new list in worksheet name Reference Data in cell d7
instead of on the same sheet, how would I do that? I thank you in advance
 
D

Don Guillett

Excel 101. Just change the copy destination.
..Copy Sheets("yoursheetnamehere").Range("d7")
Now, if you are going to use this as for a data validation list>NAME it>then
refer to =mynamedlist
 
D

David T

Thanks!

Don Guillett said:
Excel 101. Just change the copy destination.
..Copy Sheets("yoursheetnamehere").Range("d7")
Now, if you are going to use this as for a data validation list>NAME it>then
refer to =mynamedlist

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 

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