ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create folder macro or vb code? (https://www.excelbanter.com/excel-programming/428445-create-folder-macro-vbulletin-code.html)

Sherri

Create folder macro or vb code?
 
I am a novice. I need to create about two hundred folders in a specific
folder on an external drive. I have a list of the names for these folders in
an excel file. For example, Sheet1, A1 says Folder_Name, and the list of
names is in A2 thru A200. Anyone have code that will create these folders for
me?

Thanks!

Bernie Deitrick

Create folder macro or vb code?
 
Sherri,

With that sheet active:


Sub MakeFolders()
Dim myC As Range
For Each myC In Range("A2", Cells(Rows.Count, 1).End(xlUp))
MkDir "D:\Foldername\" & myC.Value
Next myC
End Sub

HTH,
Bernie
MS Excel MVP


"Sherri" wrote in message
...
I am a novice. I need to create about two hundred folders in a specific
folder on an external drive. I have a list of the names for these folders in
an excel file. For example, Sheet1, A1 says Folder_Name, and the list of
names is in A2 thru A200. Anyone have code that will create these folders for
me?

Thanks!




Patrick Molloy

Create folder macro or vb code?
 
see the Create Folder message at about 15:05 today -- its the same question
already answered with slight modification


"Sherri" wrote in message
...
I am a novice. I need to create about two hundred folders in a specific
folder on an external drive. I have a list of the names for these folders
in
an excel file. For example, Sheet1, A1 says Folder_Name, and the list of
names is in A2 thru A200. Anyone have code that will create these folders
for
me?

Thanks!



Sherri

Create folder macro or vb code?
 
Wow! That worked and could not have been easier! Thanks, Bernie!!

"Bernie Deitrick" wrote:

Sherri,

With that sheet active:


Sub MakeFolders()
Dim myC As Range
For Each myC In Range("A2", Cells(Rows.Count, 1).End(xlUp))
MkDir "D:\Foldername\" & myC.Value
Next myC
End Sub

HTH,
Bernie
MS Excel MVP


"Sherri" wrote in message
...
I am a novice. I need to create about two hundred folders in a specific
folder on an external drive. I have a list of the names for these folders in
an excel file. For example, Sheet1, A1 says Folder_Name, and the list of
names is in A2 thru A200. Anyone have code that will create these folders for
me?

Thanks!






All times are GMT +1. The time now is 05:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com