Hi, I am new the forum and could use some help with some VBA coding. I have an excel file that makes a folder and subfolders when a new entry is made in a cell based upon the cell content. The problem is if the main folder name is modified, the change is not reflected in the excel file and vice versa. I would like to be able to modify the folder name in excel, then the folder in the directory would be updated to reflect the cell content, right now if I change the cell content it just makes a new folder and subfolders. Here is the current VBA code that I am using to create the main folder and subfolders.
Any help would be greatly appreciated.
Code:
Sub makefolder()
Dim xdir As String
Dim fso
Dim lstrow As Long
Dim i As Long
Set fso = CreateObject("Scripting.FileSystemObject")
lstrow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = 2 To lstrow
xdir = "S:\Customer Files\" & Range("C" & i) & Space(1) & Range("E" & i).Value
If Not fso.FolderExists(xdir) Then fso.CreateFolder (xdir)
If Not fso.FolderExists(xdir & "\Drawings") Then fso.CreateFolder (xdir & "\Drawings")
If Not fso.FolderExists(xdir & "\Pictures") Then fso.CreateFolder (xdir & "\Pictures")
If Not fso.FolderExists(xdir & "\Manuals") Then fso.CreateFolder (xdir & "\Manuals")
If Not fso.FolderExists(xdir & "\Quotes") Then fso.CreateFolder (xdir & "\Quotes")
Range("C" & i).Formula = "=HYPERLINK(""" & xdir & """, """ & Range("C" & i).Value & """)"
Next
Application.ScreenUpdating = True
End Sub
Any help would be greatly appreciated.