Creating Folders and Sub-Folders using Excel VBA: A Step-by-Step Guide

preview_player
Показать описание
*Creating Folders and Sub-Folders using Excel VBA: A Step-by-Step Guide*

Organizing your data in a structured manner is essential for effective data management. One way to do this is by creating folders and sub-folders to store and categorize your information. This article will walk you through the process of creating folders and sub-folders using Microsoft Excel and Visual Basic for Applications (VBA).

*Step 1: * Open Microsoft Excel and press “Alt + F11” to open the VBA Editor.
*Step 2: * In the VBA Editor, go to "Insert" and select "Module" to create a new module.
*Step 4: * Close the VBA Editor by clicking “Alt + Q”.
*Step 5: * Save the Excel file in .xlsm format by going to "File" and selecting "Save As". Make sure to select "Excel Macro-Enabled Workbook" as the file type.
*Step 6: * Run the code by pressing "F5" or by clicking on "Run" in the VBA Editor.
*Step 7: * Observe the folders and sub-folders being created in the specified location as per the code.

Creating folders and sub-folders using Microsoft Excel and VBA is a simple and efficient way to manage your data. By following the steps outlined in this article, you can easily organize your Files in a structured manner. Remember to save your file in .xlsm format and to run the code after making any necessary changes to the code. With these steps, you can now effectively categorize your data and increase productivity.

#exceltutorial #create #folder #vba
Thanks for watching.
----------------------------------------------------------------------------------------
Support the channel with as low as $5
----------------------------------------------------------------------------------------
Please subscribe to #excel10tutorial

Here goes the most recent video of the channel:

Playlists:

Social media:
Рекомендации по теме
Комментарии
Автор

Beautiful work. Thank you very much.
Is it possible using this macro, or a similar one to create subfolders INSIDE the subfolders. For example 2023/012023/John/Projects

ivo.vasilevv
Автор

also, is it possible you can tell me how I can create several sub-folders in the same level under the same main folder? For example 1 main folder with 5 sub-folders in it?

escgthc
Автор

Hello I keep getting a "Run-time error 76" Path Not Found on the MkDir mainFolder & "\" & sunFolder.

Any help would be appreciated. TIA

Strikenout
Автор

Great work, I have a small issue though. I want to create folders without sub-folders, but when following your guide I get a subfolder in every folder named the same as each folder. Can you tell me how I can avoid that, so no sub-folders are created when only column A is filled?

escgthc
Автор

Worked Great, just have to make sure there are no forward or backward slashes in the filenames, thank you.

VaughnCampbell
Автор

"Run-time error '52': Bad file name or number" issue.



still same error and when I click on debug its highlighted " f Len(Dir(mainFolder, vbDirectory)) = 0 Then"

ahmedalshamsi
Автор

How to add sub folder in the sub folder can you suggest.

roshandhami
Автор

We did everything you suggested incuding coping the code however it throws out an error when i run macro

ToniWesen
Автор

سلام عليكم استاذا المحترم ارجو مساعدك لعمل كود سحب صورة من الماسح الضوئي مباشر في برنامج اكسل وشكرا لك بالتوفيق عذرا ترجمة الكتاب بالغة التي تخص❤❤❤❤❤❤

naidemnaidem
Автор

I copied everything correctly and followed your instructions carefully but I still get Run-time error '52' Bad file name or number. I have a Test folder on Desktop, no special characters, Windows 11, Office 365.

lanatep