Results 1 to 2 of 2
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Have a sheet where in column A are:
    AAAA
    BBBB
    CCCC
    AAAA
    CCCC
    CCCC
    DDDD
    ...
    ZZZZ

    Ho to loop all cells in column and create in c:\ the various dir named with the value in each cells?
    skip if already dir just existis.

  2. #2
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The following will create the directory for each value in the A column, starting in the second row.

    Code:
    Sub makeDir()
    Dim i As Long, lrow As Long, strDir As String
    lrow = Cells(Rows.Count, 1).End(xlUp).Row
    
    For i = 2 To lrow
    	strDir = "c:\" & Cells(i, 1)
    	If Dir(strDir, vbDirectory) <> Cells(i, 1) Then
    	MkDir (strDir)
    	End If
    Next
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •