+ Reply to Thread
Results 1 to 7 of 7

Loop in columns, select unique values and copy to separate list

  1. #1
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    Loop in columns, select unique values and copy to separate list

    Hello gurus,

    Need your help again in VBA. I have few columns A/B/C with footer (row 8). I need to create macro which will be able to go through all columns, for each column should be selected only Unique and <>0 values. Then this values copy to separate list, starting from cell G2. File including manual solution is attached. Appriciated for your input!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Loop in columns, select unique values and copy to separate list

    Please Login or Register  to view this content.
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  3. #3
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    Re: Loop in columns, select unique values and copy to separate list

    Hello again,

    It works, just last question - how code will look like, if my data will be in range "I25:AU32", header in range "I24:AU24", output list should start from cell "BY22"?

    Thx a lot for support!

  4. #4
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    Re: Loop in columns, select unique values and copy to separate list

    Also please can we avoid sorting? It will destroy format of my entire sheet. Header A/B/C is just example. Macro should go through first column, copy to list, then go through second column and copy unique in this column only and same loop until column N.

  5. #5
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Loop in columns, select unique values and copy to separate list

    easy way, in the worksheet with advanced filter and sort
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    Re: Loop in columns, select unique values and copy to separate list

    Hello, it's awesome...but works not fully right, until 2nd column code return error message "Run-time error 1004, Application defined or object defined error", what can be the reason?
    My template is attached, thank you!
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Loop in columns, select unique values and copy to separate list

    several columns with only 0's
    Add the 2 red lines
    Please Login or Register  to view this content.

+ 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. VBA Code - Copy Specific Columns to separate sheet for every Unique value in a column
    By excel_googler in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2021, 03:35 PM
  2. Replies: 3
    Last Post: 11-20-2020, 03:14 PM
  3. [SOLVED] Check two lists on separate worksheets and copy only unique values
    By physicsgal in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-18-2017, 12:40 PM
  4. [SOLVED] Loop through list of unique values to copy & transpose data
    By YOO629 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2015, 04:34 PM
  5. Select, copy and print data into separate columns
    By kelwood in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-08-2012, 03:46 PM
  6. Add two unique values from two separate columns
    By Mrcoop in forum Excel General
    Replies: 3
    Last Post: 09-28-2011, 05:23 AM
  7. Select only unique values in a particular columns in macro
    By ananthakumar.e in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-27-2008, 04:30 AM

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