Create folders and subfolders if condition met

mscurtin9294

New Member
Joined
Mar 28, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I am looking for help with creating a macro to create folder and subfolders per below. I have a list of level 1 folders in column A. Then I have possible subfolders below level 1 in columns B thru H. If a subfolder is required a “Yes” is placed in the applicable cell.

The macro would check if there is a name in column A (starting at A2), if present it would create that Level 1 folder. Then for that row, it would check for cells with a “Yes” and create the applicable subfolders below the Level 1 folder for that row. It would go thru each row until there is no value in column A row. I have attached an image showing the table setup and derived folder paths. I also copied mini sheet below of that table shown in the image.

Users would create an “AB_Folders_Temp” folder on their desktop before running the macro. The folders described above would all be placed within this folder. Ideally if that folder already exists and has content the macro would delete any content before making the new folders.

I am a novice at macros. I have some of the parts working but nothing that would loop as described above. I have done a bunch of searches on this site and others but am still looking for help.

Thank you for any assistance,

Mark



Direct_Mk_Folders.xlsm
ABCDEFGH
1Subfolder 1 NameSubfolder 2 NameSubfolder 3 NameSubfolder 4 NameSubfolder 5 NameSubfolder 6 NameSubfolder 7 Name
2Folder L1 TitleRequiredRequiredRequiredRequiredRequiredRequiredRequired
3Name 1YY
4Name 2YYY
5Name 3Y
6
7
8
9
10C:\Users\username\Desktop\AB_Folders_Temp\Name 1\
11C:\Users\username\Desktop\AB_Folders_Temp\Name 1\Subfolder 1 Name
12C:\Users\username\Desktop\AB_Folders_Temp\Name 1\Subfolder 3 Name
13C:\Users\username\Desktop\AB_Folders_Temp\Name 2\
14C:\Users\username\Desktop\AB_Folders_Temp\Name 2\Subfolder 2 Name
15C:\Users\username\Desktop\AB_Folders_Temp\Name 2\Subfolder 3 Name
16C:\Users\username\Desktop\AB_Folders_Temp\Name 2\Subfolder 5 Name
17C:\Users\username\Desktop\AB_Folders_Temp\Name 3\
18C:\Users\username\Desktop\AB_Folders_Temp\Name 3\Subfolder 3 Name
Sheet3
 

Attachments

  • 2022-03-28_13-12-01.jpg
    2022-03-28_13-12-01.jpg
    155.2 KB · Views: 6

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I have some code that is working for this. Probably doesn't follow many best practices, but I will post it later today. Mark
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,794
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top