A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Create folders from list vb/macro?



 
 
Thread Tools Display Modes
  #1  
Old May 13th, 2009, 07:30 PM posted to microsoft.public.excel.misc
Sherri
external usenet poster
 
Posts: 76
Default Create folders from list vb/macro?

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!
  #2  
Old May 13th, 2009, 07:40 PM posted to microsoft.public.excel.misc
Bernie Deitrick
external usenet poster
 
Posts: 2,496
Default Create folders from list vb/macro?

Sherri,

No need to post multiple places: here is my reply from programming:

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!



  #3  
Old May 13th, 2009, 07:41 PM posted to microsoft.public.excel.misc
Sherri
external usenet poster
 
Posts: 76
Default Create folders from list vb/macro?

Got it! Thanks to Bernie!

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

"Sherri" wrote:

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!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.