I am newbie in Excel. I need to something like below.
When user click on a cell or enter to cell:
-
It should automatically open/close file window.
-
When user select a file, it should pick up path/filename and put into the cell, like
c:\folder1\file1.ext -
If user select more than one file, it should pick up all path/filenames into cell,with
|as delimiter. likec:\folder1\file1.ext|d:\folder2\file2.ext -
If user click on a cell or enter to cell for a second time, it should keeps existing path/filenames and let to add other path/filnames to them like in number 3
This is similar to Sid’s, just lets you double click any single cell to open the file dialog.
In a Module
In Your Worksheet’s Code
Update
I’ve changed the getList function (it wasn’t broken, just made it do more)
It does not however support pressing enter to open the file dialog, you must double-click the cell.
Update
To help VMO (commenter)
The code in the worksheet module:
To restrict what cell(s) are double-click’able you will need to use something like that. You can change
$A$1to whatever you want or find a way to determine the target range’s name (not too difficult)If your worksheet is not locked the cell that is clicked will keep focus, and be in edit-mode which is a little annoying. Locking the cell, in previous versions of excel fixed this (i think it doesn’t work in v.2010+ though)
The code in the module (getList) can remain almost exactly the same (although you might want to remove all the code that deals with multiple files, not required though). All you need to do is add one line of code.
Hope this helps and I’ve understood what you were asking!