+ Reply to Thread
Results 1 to 5 of 5

Macro to sort values into three columns

  1. #1
    Registered User
    Join Date
    04-06-2011
    Location
    australia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Macro to sort values into three columns

    hi i have a macro to copy values from a single column and sort them into three colums

    i basically works, it finds marker 1 drops down a cell picks up the value then pastes into the corresponding column etc tec

    cell "a1" holds the value for "marker 1"

    this is the origional single column
    marker 1
    value 1 (--> goes into column 1)
    value 2 (--> goes into column 2)
    value 3 (--> goes into column 3)
    marker 2
    value 1 (--> goes into column 1)
    value 2 (--> goes into column 2)
    value 3 (--> goes into column 3)
    marker 1
    value 1 (--> goes into column 1)
    value 2 (--> goes into column 2)
    value 3 (--> goes into column 3)
    marker 3
    value 1 (--> goes into column 1)
    value 2 (--> goes into column 2)
    value 3 (--> goes into column 3)

    (the problem is my macro pasts the values into the second and third colums but not into the first, then if i rerun the macro again it pastes the vale into the first column but not the second two)

    Please Login or Register  to view this content.
    Last edited by pike; 04-06-2011 at 12:56 AM. Reason: add code tags for newbie PM rule

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to sort values into three columns

    Click GO ADVANCED and use the paperclip icon to post up a workbook showing exact BEFORE/AFTER sheets demonstrating what you're wanting to.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    04-06-2011
    Location
    australia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Macro to sort values into three columns

    Quote Originally Posted by JBeaucaire View Post
    Click GO ADVANCED and use the paperclip icon to post up a workbook showing exact BEFORE/AFTER sheets demonstrating what you're wanting to.
    thanks for your help. i think worked it out.it seems to run ok now.

    It is pasting the cells from the the column of raw dat into the columns, can you tell me how to get my macro to loop through the whole list. at the moment it only creates the first row.. thanks very much
    Attached Files Attached Files

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro to sort values into three columns

    This will do the same job: (and much faster)

    Please Login or Register  to view this content.
    Last edited by snb; 04-06-2011 at 07:50 AM.



  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to sort values into three columns

    hi, deville, please check attachment, run code "test"
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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