1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Sub CreaRep()
Dim i&, K&, Col%, MaxLigne&
Dim MonChemin$, SousDossier$
Dim Tmp As Variant
'MonChemin = Bureau pour les tests
'MonChemin = CreateObject("WScript.Shell").specialFolders("Desktop") & "\"
With Sheets("Calcul")
MaxLigne = .Cells.Find("*", Cells(.Rows.Count, .Columns.Count), xlValues, , 1, 2, 0).Row
For i = 19 To MaxLigne
'Pour les colonnes de F à AK
For Col = 6 To 37
If .Cells(i, Col) <> "" Then
Tmp = Split(.Cells(i, Col), "\")
SousDossier = MonChemin
For K = LBound(Tmp) To UBound(Tmp)
SousDossier = SousDossier & Tmp(K) & "\"
'Si le dossier n'existe pas
If Dir(SousDossier, vbDirectory) = "" Then
'creation du dossier
MkDir SousDossier
End If
Next K
End If
Next Col
Next i
End With
End Sub |
Partager