Code:
Sub GenerateFoldersFromColumnH()
Dim ws As Worksheet
Dim lastRow As Long
Dim folderName As String
Dim folderPath As String
Dim i As Long
' Set your target worksheet
Set ws = ThisWorkbook.Sheets("Sheet1") ' Rename if needed
' Find the last used row in column H
lastRow = ws.Cells(ws.Rows.Count, "H").End(xlUp).Row
' Loop through each row in column H
For i = 2 To lastRow ' Start from row 2 assuming row 1 is a header
folderName = Trim(ws.Cells(i, "H").Value)
' Skip blank folder names
If folderName <> "" Then
folderPath = " C:\Jobs\" & folderName
' Check if folder exists
If Dir(folderPath, vbDirectory) = "" Then
MkDir folderPath
Else
MsgBox "Folder already exists for: " & folderName, vbInformation, "Duplicate Folder"
Exit Sub
End If
End If
Next i
End Sub