+ Reply to Thread
Results 1 to 8 of 8

Sort columns B,C,D based on column B then loop to next 3 columns and repeat till last colu

  1. #1
    Registered User
    Join Date
    03-20-2017
    Location
    Lancashire, England
    MS-Off Ver
    2010
    Posts
    40

    Sort columns B,C,D based on column B then loop to next 3 columns and repeat till last colu

    Hi Guy's I am looking for a little bit of help if possible.

    I have a worksheet that contain numerous columns of data that has been imported from other worksheets.

    The columns start at column B and repeat every 3 columns. The number of columns can vary per worksheet.

    The number of rows can also vary within the blocks of 3 columns. (e.g. columns B,C D may have 20 rows. columns E,F,G may have 27 rows etc.)

    I have managed to sort the first 3 columns using the code below, but can not work out how to loop through to the next 3 columns and so on until the last column.

    Please Login or Register  to view this content.
    I would welcome any help and advice.

    Sorry for cross posting but still new at this, please cross find post here
    https://www.mrexcel.com/forum/excel-...ml#post4798951

    Many thanks
    Andy
    Last edited by Andy15; 04-09-2017 at 05:32 PM.

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

    Re: Sort columns B,C,D based on column B then loop to next 3 columns and repeat till last

    May be
    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

  3. #3
    Registered User
    Join Date
    03-20-2017
    Location
    Lancashire, England
    MS-Off Ver
    2010
    Posts
    40

    Re: Sort columns B,C,D based on column B then loop to next 3 columns and repeat till last

    Hi YasserKhalil,

    Your solution is absolutely brilliant. I can't believe the speed with which you replied and sorted. I have a long way to go and a lot to learn

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Sort columns B,C,D based on column B then loop to next 3 columns and repeat till last

    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Registered User
    Join Date
    03-20-2017
    Location
    Lancashire, England
    MS-Off Ver
    2010
    Posts
    40

    Re: Sort columns B,C,D based on column B then loop to next 3 columns and repeat till last

    Thanks for the advice. Sorry but still learning.

  6. #6
    Registered User
    Join Date
    03-20-2017
    Location
    Lancashire, England
    MS-Off Ver
    2010
    Posts
    40

    Re: Sort columns B,C,D based on column B then loop to next 3 columns and repeat till last

    Hi

    I have tried to add a CustomOrder:= _
    "10115960,902240,11241290,10080910", Header:=xlYes

    but I get a named argument not found error.

    please can you advise

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Sort columns B,C,D based on column B then loop to next 3 columns and repeat till last

    Rule 08: Cross-posting Without Links

    Your post does not comply with Rule 8 of our Forum RULES. Do not cross-post your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    No further help to be offered, please, until the OP has complied with this request.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Registered User
    Join Date
    03-20-2017
    Location
    Lancashire, England
    MS-Off Ver
    2010
    Posts
    40

    Re: Sort columns B,C,D based on column B then loop to next 3 columns and repeat till last

    Sorry about that. I am still learning but having read the reasons I fully understand why it is not good to cross post.

    Thanks for pointing me in the right direction

    I have added a link in first post as requested

    Thanks
    Last edited by Andy15; 04-09-2017 at 07:29 PM.

+ 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. Sort multiple columns by one column until BLANK, then REPEAT
    By Tamichan5 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2017, 09:06 PM
  2. [SOLVED] sort columns based on another column
    By kuntalnr in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-11-2015, 06:41 PM
  3. Help with Macro: I need to fill columns D-N only up till the row number in column A
    By zizou0178 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-19-2014, 02:16 PM
  4. Copy entire selected column to next columns till last column
    By siroos12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2013, 05:20 AM
  5. [SOLVED] VBA SUMIF Loop - Repeat for multiple columns
    By SimonJF in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-14-2013, 12:12 AM
  6. [SOLVED] Sort multiple columns based on column header
    By Langer101 in forum Excel Programming / VBA / Macros
    Replies: 39
    Last Post: 01-09-2013, 09:55 AM
  7. Delete every alternate columns till the last data in the row from column G
    By andywsw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2012, 11:59 PM

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