The code below does the following perfectly in Windows
1) automatically creating a folder structure based on entry in Column 3; and
2) automatically creating a hyperlink in the appropriate column.
1) automatically creating a folder structure based on entry in Column 3; and
2) automatically creating a hyperlink in the appropriate column.
The code can be found below:
Code:
If Not Intersect(Target, Columns(3)) Is Nothing Then
Dim tr As String
With Target
tr = ThisWorkbook.Path & "\" & .Offset(, -2).Value
If Len(Dir(tr)) = 0 Then
MkDir tr
MkDir tr & "\Folder 1"
MkDir tr & "\Folder 2"
MkDir tr & "\Folder 2" & "\Subfolder1"
MkDir tr & "\Folder 2" & "\Subfolder 2"
.Hyperlinks.Add .Offset(, 4), tr, TextToDisplay:="NAME"
End If
End With
End If
End Sub
I have been trying to get this to work on Mac but I always get and error 68 and then debugger opens on line
If Len(Dir(tr)) = 0 Then
I have tried changing the \ in tr and mk dir
to
using :
using \
using " " (basically empty space)
I tried changing "(denominator)" to application.pathseparator - still nothing.
I can only make this work if I remove the line
If Len(Dir(tr)) = 0 Then
Any thoughts? I am totally perplexed by this - there must be a way of maintaining this line?
Luke
Last edited: