Active Cell Filling

G

Guest

Hi,
I wanted to have control over the files present in my hard drives..My Date
is 3 columns A,B,C. column A has drive name Column B has short discription of
file and Column C will have the names of files..to fill in column c i have
used this VBA code.



Sub Filenames()
Dim FName As Variant
If Application.ActiveCell.Address = "$C$2" Then

FName = Application.GetOpenFilename(filefilter:="All Files, *.*) *.*")
If FName <> False Then
Worksheets("Sheet1").Cells(5, 3).Value = FName
End If
End If
End Sub

My Requirement is that when ever i click on any cell in column c. the above
code have to run and fill the complete file name in that cell. like this
automatically moves to next cell and next cell to fill up column C...plz help
on this.
 
G

Guest

Not sure what you mean but put this into the sheet1 module

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell = Range("C2") Then
Run "Filenames"
End If
End Sub
 
G

Guest

Hi.

Sorry I wud not put up a meaningful query. But Wat I wanted is that when I
click any cell in a Column C > the filepick dialog shuld open > and the
selected file fills up that cell>Cell moves to next column, then I will clik
the cell just below which will repeat the above and fills up the file
selected the active cell moves to another column(which makes code stop) ..and
to fill up again i will clik the next below cell in column C only like this
this will continues..upto when i stop clicking the cells in column C.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top