Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default Create folders from excel

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Create folders from excel

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Create folders from excel

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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I create folders in explorer from an excel list njmcr Excel Discussion (Misc queries) 5 February 28th 13 12:22 PM
Can excel automatically create folders Can excel automatically create folders Excel Discussion (Misc queries) 1 June 23rd 08 09:38 PM
Create Folders From Excel WBTKbeezy Excel Programming 4 November 28th 07 03:07 PM
Can anyone help me Create Excel list of files in windows folders solrac1956 Excel Worksheet Functions 1 November 28th 05 11:07 PM
To create folders using VBA Sri Excel Discussion (Misc queries) 1 February 4th 05 01:13 PM


All times are GMT +1. The time now is 05:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"