Macro to create multi subfolders

Caveman1964

Board Regular
Joined
Dec 14, 2017
Messages
127
Office Version
  1. 2016
Platform
  1. Windows
Hi! please help. Beginner here.
I want to create this from a macro.

L:\Packets"data from cell A1""data from cell A2"data from A1 then Material at the end of it".xlsm

so it would look something similar in the directory when finished;
L:\Packets\Wheelbarrel\12345678\12345678Material.xlsm

What I have is a mess....its getting worse each time I amend! ugh.........any help is much appreciated.
Thanks
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Code:
Dim fPath As string
With ActiveSheet
 fPath = "L:\Packets" & "\" & .Range("A1").Value & "\" & .Range("A2").Value & "\" & .Range("A3").Value & "Material.xlsm"
End With

This puts your directory path in a variable which you can then use throughout the code to save space when you need to referto the file.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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