PC Review


Reply
Thread Tools Rate Thread

Create folders from excel

 
 
Boss
Guest
Posts: n/a
 
      7th Mar 2008
Hi,

I wish to create 100 folders in c drive, the folders should be named as
names written in range a1:a100

i tried somenthing like this

Sub AnewOne()
MkDir "C:\Kevin"
MkDir "C:\Jack"

End Sub

I am sure there is a better way. please hepl..
Boss


 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      7th Mar 2008
Sub MakeDirectories()
Dim n As Integer
n = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To n
MkDir (Cells(i, 1).Value)
Next
End Sub
--
Gary''s Student - gsnu200772
 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      7th Mar 2008
I'm going to guess that the path is not included with the names in the
cells...

Sub MakeDirectories()
Dim n As Integer
n = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To n
MkDir "c:\" & Cells(i, 1).Value
Next
End Sub

Also note I removed the parentheses from around the argument to MkDir...
doesn't hurt in this case, but using them when they are not required by
syntax can cause errors in a lot of cases.

Rick


"Gary''s Student" <(E-Mail Removed)> wrote in message
news:28159833-3B4B-44DC-AB00-(E-Mail Removed)...
> Sub MakeDirectories()
> Dim n As Integer
> n = Cells(Rows.Count, 1).End(xlUp).Row
> For i = 1 To n
> MkDir (Cells(i, 1).Value)
> Next
> End Sub
> --
> Gary''s Student - gsnu200772


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create folders and subfolders from Excel wedor Microsoft Excel Discussion 4 25th Jun 2009 06:32 PM
Can excel automatically create folders Can excel automatically create folders Microsoft Excel Misc 1 23rd Jun 2008 09:38 PM
Create Folders From Excel WBTKbeezy Microsoft Excel Programming 4 28th Nov 2007 03:07 PM
How to create folders in outlook from folders list in excel =?Utf-8?B?TWlrZQ==?= Microsoft Outlook Discussion 1 19th Jan 2006 11:11 PM
Create Folders in Directory with Excel VBA? Jrew23 Microsoft Excel Discussion 4 16th Jun 2005 03:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:18 PM.