+ Reply to Thread
Results 1 to 2 of 2

Bubble sort to sort array of file names by file extension

  1. #1
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Bubble sort to sort array of file names by file extension

    Hi,
    I have a list of file names in an array and want to sort them by the file extension in either ascending or descending order.
    I've created a bubble sort, but it's not returning the expected results.

    This code takes an array of 11 files and attempts to sort they by the file extension in descending order (depending on the flag).
    Please Login or Register  to view this content.
    The expected result of this would be:
    Myfile2.msg
    Myfile6.msg
    Myfile8.lnk
    Myfile1.jpg
    Myfile7.jpg
    Myfile9.jpg
    Myfile3.docx
    Myfile4.docx
    Myfile5.docx
    Myfile10.docx
    Myfile11.docx


    But instead it returns
    Myfile8.lnk
    Myfile6.msg
    Myfile9.jpg
    Myfile2.msg
    Myfile7.jpg
    Myfile1.jpg
    Myfile4.docx
    Myfile5.docx
    Myfile3.docx
    Myfile10.docx
    Myfile11.docx

  2. #2
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Bubble sort to sort array of file names by file extension

    I think I figured it out.
    I needed to refresh FileEx_i after the swap.

+ 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. Replies: 5
    Last Post: 12-29-2022, 06:35 AM
  2. Replies: 5
    Last Post: 12-23-2022, 04:02 AM
  3. File Names and extension help
    By bp728 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-07-2018, 12:35 AM
  4. Replies: 4
    Last Post: 10-23-2013, 12:54 AM
  5. Pull file names of a certain type or extension into Excel.
    By Owompa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-20-2013, 05:39 PM
  6. Problems with Bubble Sort on 2D Array
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-20-2006, 12:55 PM
  7. [SOLVED] Saving two file names? One with no extension?
    By Rick S. in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-21-2005, 09:07 PM

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