Hello, I am just starting with VB and macros for Excel.
I am trying to re-purpose some code I found at another place (T. Nesset) (https://stackoverflow.com/questions/5153…b=votes#tab-top)
Code
Private Sub CommandButton1_Click()
Dim FolderPath As String
If Not Application.Intersect(ActiveCell, Range("A:A")) Is Nothing Then
If ActiveCell.Hyperlinks.Count = 0 Then
'Main folder path
FolderPath = "C:\Users\" & Environ("Username") & "\Desktop\all_files\"
'Make the directory assuming the "all_files folder" is already existing
MkDir FolderPath & ActiveCell.Value
'Make the sub directory "Test1"
MkDir FolderPath & ActiveCell.Value & "\Test1"
End If
End If
End Sub
Display More
It uses a selected cell's value to create and name folder. Also it creates a sub-folder with the name "Test1".
That is OK and works but I need have as a name the cell value and the word "Test1" both in the name of the subfolder.