+ Reply to Thread
Results 1 to 6 of 6

Using VBA to create a unique list.

  1. #1
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Using VBA to create a unique list.

    I have a list of names in a worksheet and I want to create a unique name list from this list on another sheet. I'm using the following code but it doesn't quite work. Any help please?

    Option Explicit

    Sub CreateUniqueList()
    Dim lastrow As Long

    lastrow = Cells(Rows.Count, "B").End(xlUp).Row

    Worksheets("Weekly Archives").Range("B2:B" & lastrow).AdvancedFilter _
    Action:=xlFilterCopy, _
    CopyToRange:=ActiveSheet.Range("H2"), _
    Unique:=True

    End Sub

  2. #2
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Re: Using VBA to create a unique list.

    I should have added that it's huge list and I think code will be faster than a formula.

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Using VBA to create a unique list.

    Try this code
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  4. #4
    Forum Contributor myobreportguru's Avatar
    Join Date
    09-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2016
    Posts
    231

    Re: Using VBA to create a unique list.

    Thank you Yasser that did the trick.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,500

    Re: Using VBA to create a unique list.

    To speed up things a bit.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Using VBA to create a unique list.

    Quote Originally Posted by myobreportguru View Post
    Thank you Yasser that did the trick.
    You're welcome. Glad I can offer some help
    Thank you very much for Mr. Bakerman for his great and awesome solution

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Create unique list from data but listed in order based on a different list
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-24-2016, 12:54 PM
  2. Create unique # of worksheets based on list count with unique names
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-24-2016, 09:51 AM
  3. Create dropdown list in Excel that will only list unique entries
    By MissAudrey in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 01-22-2015, 04:56 PM
  4. [SOLVED] create list of unique staff numbers with unique work codes
    By shaz0503 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-01-2013, 08:57 PM
  5. VBA: Create unique list based on latest entry in list
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-08-2011, 09:55 AM
  6. Replies: 5
    Last Post: 01-12-2011, 08:49 AM
  7. Copy from list when different (create unique list with formulas)
    By pansovic in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-20-2010, 11:14 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1