You are on page 1of 2

Crear SubCarpetas

Sub CrearSub_Carpetas()
Dim i As Integer
Dim j As Integer
i = 0
ruta = InputBox("INGRESAR LA RUTA")
Range("A1").Select
On Error Resume Next
Do While ActiveCell.Value <> ""
i = i + 1
MkDir (ruta & "/" & ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
Loop
For j = 1 To i Step 1
Cells(j, 2).Select
If ActiveCell.Value <> "" Then
On Error Resume Next
Do While ActiveCell.Value <> ""
MkDir (ruta & "/" & Cells(j, 1).Value & "/" & ActiveCell.Value)
ActiveCell.Offset(0, 1).Select
Loop

MkDir (ruta & "/" & ActiveCell.Offset(-1, 0).Select & "/" & ActiveCell.Value)

End If
Next j
End Sub

Crear SubCarpetas Anidadas

Sub CrearSubCarpetasAnidadas()

Dim i As Integer
Dim j As Integer

Range("A1").Select
a = 0
Do While ActiveCell.Value <> ""
a = a + 1
ActiveCell.Offset(0, 1).Select
Loop

Range("A1").Select
b = 0
Do While ActiveCell.Value <> ""
b = b + 1
ActiveCell.Offset(1, 0).Select
Loop

ruta = InputBox("INGRESAR LA RUTA")

On Error Resume Next


For i = 1 To b Step 1
ruta1 = ruta
For j = 1 To a Step 1
Cells(i, j).Select
MkDir (ruta1 & "/" & ActiveCell.Value)
ruta1 = ruta1 + "/" + Cells(i, j)
Next j
Next i

End Sub

You might also like