Open multiple Excel files alphabetically

CJ 0 Reputation points
2025-12-23T07:19:37.8366667+00:00

I want to open multiple Excel (365 in Windows 11) files in alphabetical order (as they are in the folder) however, they keep opening in random order and it's driving me nuts.  In previous versions of Excel, the files would open in alphabetical order. 

I've tried individually selecting them but once past 3 or 4 files it starts messing them up. I used to just select 30 files, hit enter and they'd open in the correct order, now it's all higgeldy-piggeldy and extremely annoying.

It's bad enough that the program itself is slower than the older one, I've managed to adapt my input method to work around it, but I really am annoyed with this problem.

Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alina-Le 5,080 Reputation points Microsoft External Staff Moderator
    2025-12-23T10:01:58.9833333+00:00

    Hello @CJ

    Welcome to Q&A forum!

    I totally understand how inconvenient this is. When you’ve gotten used to Excel opening multiple files in alphabetical order, having that behavior disappear in newer versions of Excel/Windows can really throw off your workflow.

    Unfortunately, Excel no longer guarantees that files will open in alphabetical order, so they may open in a random sequence instead.

    *

    I have created six Excel files named "A, B, C, D, E, and F". When I tested by selecting and opening all files in the same folder (File Testing) at once, I confirmed your concern: these files open in a random order, likely depending on the loading time of each file, rather than alphabetically as expected. 

    .

    To support you, I tested a workaround, and it worked on my end. I will guide you through the steps in detail, along with images, so you can practice on your side. 

    *I understand this may seem complicated, but if you follow these steps, you will not only resolve this issue for future cases but also learn a new Excel skill: how to run a Macro. 

    Guidance to Open Files Alphabetically Using a Macro 

    1. Copy the folder address 

    Copy the address of the folder that contains the files you want to open alphabetically. 

    "File Explorer -> Navigate to the file that you want to open alphabetically" -> Right click on File location path and choose "Copy address"

    User's image

    User's image

    2. Show the Developer tab 

    (If you already have the “Developer” button on the Excel toolbar as shown below, you can skip this step.) 

    Go to:  "File" -> "Options" -> "Customize Ribbon" -> Check “Developer” -> Click "OK "

    After this, you will see the “Developer” tab next to the “File” and “Home” buttons. 

    User's image User's image

    User's image

    User's image

    3. Open the VBA Editor and Insert a New Module 

    (Visual Basic for Applications (VBA) editor) 

    Steps:  "Developer" -> "Visual Basic" (or press Alt + F11) → "Insert" → "Module" → "Copy and paste" the Macro code"  below (Replace the “Folder path” in the code with the address you copied earlier) →
    "Close" the editor.
     

    Sub OpenFilesAlphabetically()

    Dim folderPath As String

    Dim fileName As String

    ' ?? Folder that contains your Excel files

    folderPath = "C:\Users\___\Downloads\File testing\"

    ' Get the first .xlsx file in alphabetical order

    fileName = Dir(folderPath & "*.xlsx")

    Do While fileName <> ""

    Workbooks.Open folderPath & fileName

    fileName = Dir() ' Get the next file

    Loop

    End Sub

    User's image User's image

    User's image

    4. Run the Macro 

    Steps:  Open a blank Excel file → Click “Developer” → “Macro” (or press Alt + F8) → Select "OpenFileAlphabetically" → Click Run

    User's image User's image

     After that you can see these files open alphabetically as the below image from A to F

     

    User's image

    You can reopen the VBA editor anytime to replace the “Folder path” if you want to apply this for another folder. 

    *For your reference:

    Show the Developer tab - Microsoft Support

    Getting started with VBA in Office | Microsoft Learn

    Run a macro in Excel - Microsoft Support

    Wishing you a peaceful and joyful end of the year with your family and loved ones. 


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in "our documentation" to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.