file browser when a cell in selected
On Tue, 3 Feb 2004 04:46:35 -0600, dreamer
wrote:
Is there a way to make the dialog box which opens a file appear when a
certain cell is selected? For example if cell A2 is selected, a
dialogbox for opening a file asks user which file should be opened and
the writes the name of the file to cell A2.
Right click on the sheet tab and select "View Code", then paste this
into the module that appears:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim vnt As Variant
If Target.Address = "$A$2" Then
vnt = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If vnt = False Then
Exit Sub
Else
Target.Value = vnt
End If
End If
End Sub
---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *
|