Prev: How to prevent "Private Sub Workbook_SheetSelectionChange" to execute when a certain sub is executed ?
Next: How to browse folder and open xls file automatically in vba?
From: primed on 21 Dec 2009 02:35 Hi, I have a list of names in excel, approx 500 long. I need to create a folder for each one. How do i do it automatically? Thanks
From: Rick Rothstein on 21 Dec 2009 02:51 You would use the MkDir statement to do that... it requires you specify the full path as its argument. This is the description provided in the help files... "Creates a new directory or folder. Syntax: MkDir path The required path argument is a string expression that identifies the directory or folder to be created. The path may include the drive. If no drive is specified, MkDir creates the new directory or folder on the current drive." -- Rick (MVP - Excel) "primed" <primed(a)discussions.microsoft.com> wrote in message news:EFB861D5-0794-4872-9E8A-2E02DCA267BC(a)microsoft.com... > Hi, > > I have a list of names in excel, approx 500 long. I need to create a > folder > for each one. How do i do it automatically? > > Thanks
From: Jacob Skaria on 21 Dec 2009 03:28 Try the below Sub Macro() Dim cell As Range For Each cell In Range("A1:A500") MkDir "c:\" & cell.Text Next End Sub -- Jacob "primed" wrote: > Hi, > > I have a list of names in excel, approx 500 long. I need to create a folder > for each one. How do i do it automatically? > > Thanks
From: primed on 21 Dec 2009 20:10
Excellent, Thankyou. I had to try it a few times as the list contained data that went against file naming conventions. Thanks "Jacob Skaria" wrote: > Try the below > > Sub Macro() > Dim cell As Range > For Each cell In Range("A1:A500") > MkDir "c:\" & cell.Text > Next > End Sub > > > -- > Jacob > > > "primed" wrote: > > > Hi, > > > > I have a list of names in excel, approx 500 long. I need to create a folder > > for each one. How do i do it automatically? > > > > Thanks |