Solved

New sheet with one of each name

Posted on 2011-03-07
9
165 Views
Last Modified: 2012-05-11
Hiya all

I have a sheet that has lots of the same values in one coloum. I want to be able to create a new sheet that show a single coloum with only one of each of the items:

So this is and example of the sheet i have:

doors
chairs
planks
chairs
chairs
planks
chairs
planks
chairs
planks
chairs
planks

And on the next sheet i want it to ony show one of each like this:

doors
chairs
planks
0
Comment
Question by:willa666
  • 5
  • 4
9 Comments
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35059355
If you are using MS Excel 2007 onwards then this will help you. Just rename the Sheets and Column names as applicable.

Sub Sample()
    Sheets("Sheet1").Columns("A:A").Copy Sheets("2").Columns("A:A")
    Application.CutCopyMode = False
    Sheets("Sheet2").Range("$A$1:$A$12").RemoveDuplicates Columns:=1, Header:=xlNo
End Sub

Open in new window


Sid
0
 
LVL 1

Author Comment

by:willa666
ID: 35059469
hi SiddharthRout

I am using excel 2011 on the mac so it should support your solution. But i am used to using formuals and am not sure how i would use you soultion.
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35059480
Paste the code in a module in the VBA editor and simply run the macro "Sample"

Sid
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:willa666
ID: 35059601
So i managed to create the macro and when i run it i get this error:
Run-Time error '9':

Subscript out of range

Open in new window

0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35059611
Ok. Upload your exact file. Let me amend it upload it for you :)

Sid
0
 
LVL 1

Author Comment

by:willa666
ID: 35059670
Thank you matey
Workbook1.xlsm
0
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 500 total points
ID: 35059696
Here it is. The output will be generated in Sheet2

Sid

Code Used

Sub Sample()
    Dim lastRow As Long
    
    Sheets("Sheet1").Columns("A:A").Copy Sheets("Sheet2").Columns("A:A")
    Application.CutCopyMode = False
    
    lastRow = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
    
    Sheets("Sheet2").Range("$A$1:$A$" & lastRow).RemoveDuplicates Columns:=1, Header:=xlNo
End Sub

Open in new window

Workbook1.xlsm
0
 
LVL 1

Author Comment

by:willa666
ID: 35059717
:) that works great thank you
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35059719
You are welcome :)

Sid
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question