+ Reply to Thread
Results 1 to 8 of 8

Need Macro To Sequence And Auto Sort Data

  1. #1
    Registered User
    Join Date
    10-29-2017
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    62

    Need Macro To Sequence And Auto Sort Data

    Hi,

    Need help to have a macro to do auto sequence

    Macro will lookup to column F for the sequence under "Data" tab. Based on column F "number starts from 7xxx", sequence will be 1,2,3,4,etc, then "number starts from Axxx", sequence will be 1,2,3,4,etc. as long starting number/alphabet is different, sequence will restart to 1,2,3,4,etc

    With the sequence determine, I need the macro to go to "Shortage" tab and do the auto sort of the whole data in it. Need the macro to sort column A based on sequence of the same material#.


    TIA!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    10-29-2017
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    62

    Re: Need Macro To Sequence And Auto Sort Data

    I have put in additional column called "Seq" in both tabs and do a macro. However, i do not want to add additional columns and would like the macro do the sequence background.

    I cannot get the code right. Need help on this.

    TIA
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Need Macro To Sequence And Auto Sort Data

    Try looking here for more info https://www.thespreadsheetguru.com/t...ort-cell-range. Cheers

  4. #4
    Registered User
    Join Date
    10-29-2017
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    62

    Re: Need Macro To Sequence And Auto Sort Data

    Hi maniacb,
    Thanks for the info. However, I want to sequence based on column F of the other tab "Data".

    Also I need the sequencing to base on individual numbers starts from 7xxx, Axxx, Bxxx, etc.

  5. #5
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Need Macro To Sequence And Auto Sort Data

    Hi Bubbles_A,

    Sorry if I'm not helping here.
    Not sure how you want the result,
    but maybe the code below is a little help :

    Please Login or Register  to view this content.
    The code above will get the sequence number then put it on the next column of the Slot#:
    2020-06-09_18-35-13.gif

    It first collect the unique value of the first character which are in the Slot# list into array.
    Then based on each item of the array, it loops on the Slot# list.
    it then put the number sequence on the next cell each time the item match in the list.

    For example, in your macro you can have a column helper where you put the vlookup formula,
    sort your data in "Shortage" sheet, then clear the contents of the column helper and clear the sequence result in "Data" sheet.

    But to be honest I'm not so sure if the code can help you to get your expected result.
    Last edited by karmapala; 06-09-2020 at 06:50 AM.

  6. #6
    Registered User
    Join Date
    10-29-2017
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    62

    Re: Need Macro To Sequence And Auto Sort Data

    Thanks, Karmapala. Nice! This does help me.

    So I tried to add in all my other macros and try to sort it (first column B, followed by column AL) in "Shortage" tab. Seems like it does not work.

    Need help to see what went wrong.

    TIA
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Need Macro To Sequence And Auto Sort Data

    Hi Bubbles_A,
    I'm very sorry for my late reply.

    Quote Originally Posted by Bubbles_A View Post
    Thanks, Karmapala. Nice! This does help me.
    Glad that the code can do a little to your expectation.

    So I tried to add in all my other macros and try to sort it (first column B, followed by column AL) in "Shortage" tab.
    Seems like it does not work.
    I downloaded your attachment sample workbook then run your code.
    In my side it doesn't throw me an error.

    So, the "does not work" that you mean is:
    A. it throw you an error
    B. it does not throw you an error, but the result is not that you are expecting.

    Is it A or B ?

  8. #8
    Registered User
    Join Date
    10-29-2017
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    62

    Re: Need Macro To Sequence And Auto Sort Data

    Hi,
    I managed to get it solved. Thanks for all the help rendered.

+ 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. Macro to auto sort rows based on data changes
    By jasonfmerritt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-29-2016, 07:43 PM
  2. [SOLVED] Macro Needed to Auto Sort Column As Data Changes
    By Statzcom in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-02-2014, 04:46 PM
  3. How to sort the data in correct sequence of date and item code?
    By Zecond in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-30-2013, 09:16 PM
  4. Macro required to auto sort worksheet when new data is entered
    By ravinella in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-21-2013, 11:32 AM
  5. Need help building macro to auto sort two columns of data
    By staralfur in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-12-2011, 01:37 PM
  6. How can I sort data in sequence by odd/even numbers
    By TxBlackJack in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-19-2006, 01:15 PM
  7. Help:macro to auto sort data to different worksheets...
    By 2nd Time Around in forum Excel General
    Replies: 2
    Last Post: 08-06-2005, 08:05 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