Private Sub Worksheet_BeforeDoubleClick(ByVal target As Range, Cancel As Boolean)
Set t = target
Set e6 = Range("e6")
If Intersect(t, e6) Is Nothing Then Exit Sub
Cancel = True
ChDir "C:\Users\boymam\desktop"
If Instr(ChrDir,".") = False then 'Should be a '.' not a ',' as I stated above.
'If a folder
Which = Application.GetOpenFilename(MultiSelect:=True)
If IsArray(Which) Then
For I = 1 To UBound(Which)
Workbooks.Open Which(I)
Next
End If
Else
'If a file
Workbooks.Open(ChrDir)
End IF
End Sub
If it's directed to a folder it will execute the code you provided (I have't checked this so I assume your code already works for folders), if it's a file (or rather has a file extension), then it will just directly open the file. Is that long the lines of what you were looking for?
Bookmarks