' This macro will give a file open dialog to select a file. The result of the selection is written as a text into the selected cell Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Application.ScreenUpdating = False 'parameters Set myRangeWatch_F = Range("B:B") Set myRangeWatch_D = Range("C:E") ' watching for new directories to add If Not Application.Intersect(Target, myRangeWatch_D) Is Nothing Then Set d = Application.FileDialog(msoFileDialogFolderPicker) ' directories dialog With d .AllowMultiSelect = False .Title = "Select a directory to which we will be writing the source file" End With If Target.Cells.Count = 1 Then If d.Show Then Target.Value = d.SelectedItems.Item(1) Cells.EntireColumn.AutoFit End If End If ' activate this line to test 'MsgBox Target.Address & " has been double-clicked" ' watch for files ElseIf Not Application.Intersect(Target, myRangeWatch_F) Is Nothing Then Set f = Application.FileDialog(msoFileDialogOpen) ' directories dialog With f .AllowMultiSelect = False .Title = "Select a source file that will be copied" End With If Target.Cells.Count = 1 Then If f.Show Then Target.Value = f.SelectedItems.Item(1) Cells.EntireColumn.AutoFit End If End If End If Cells.EntireColumn.AutoFit Application.ScreenUpdating = True End Sub