Try this out. It assumes you start at column "A" and it also starts the directory in C:\ (using the sDir variable). Just change "C:\" to whatever you want your base point to be if you need to.
Option Explicit
Sub startCreating()
Call CreateDirectory(2, 1)
End Sub
Sub CreateDirectory(ByVal row As Long, ByVal col As Long, Optional ByRef path As String)
If (Len(ActiveSheet.Cells(row, col).Value) <= 0) Then
Exit Sub
End If
Dim sDir As String
If (Len(path) <= 0) Then
path = ActiveSheet.Cells(row, col).Value
sDir = "C:\" & path
Else
sDir = path & "\" & ActiveSheet.Cells(row, col).Value
End If
If (FileOrDirExists(sDir) = False) Then
MkDir sDir
End If
If (Len(ActiveSheet.Cells(row, col + 1).Value) <= 0) Then
Call CreateDirectory(row + 1, 1)
Else
Call CreateDirectory(row, col + 1, sDir)
End If
End Sub
' Function thanks to: http://www.vbaexpress.com/kb/getarticle.php?kb_id=559
Function FileOrDirExists(PathName As String) As Boolean
'Macro Purpose: Function returns TRUE if the specified file
' or folder exists, false if not.
'PathName : Supports Windows mapped drives or UNC
' : Supports Macintosh paths
'File usage : Provide full file path and extension
'Folder usage : Provide full folder path
' Accepts with/without trailing "\" (Windows)
' Accepts with/without trailing ":" (Macintosh)
Dim iTemp As Integer
'Ignore errors to allow for error evaluation
On Error Resume Next
iTemp = GetAttr(PathName)
'Check if error exists and set response appropriately
Select Case Err.Number
Case Is = 0
FileOrDirExists = True
Case Else
FileOrDirExists = False
End Select
'Resume error checking
On Error GoTo 0
End Function