I'm trying to apply a macro over a cell/range. However, I'm clueless on how to utilize the range in my code. My current code for one cell is as follows:

Sub Populate()
Dim iLn
fname = Cells(ActiveCell.Row, 1).Value
ff = FreeFile
Open "C:\Exceltest\" & fname & ".txt" For Input As #ff
iLn = LOF(ff)
fsdata = Input(iLn, #ff)
Close #ff
ActiveCell.Value = fsdata
End Sub
What I'm doing here is populating an active cell with data that's contained in a file who's name I identify from the first column of the respective row that is active. This code works fine when I have just one cell selected.

I wish to extend this functionality when I select a range of cells on the worksheet as well. I just selected a range and tried to run the macro, but it populated only the first (active) cell, which I guess is valid.

My question is: What properties would let me access a selection/range in the above case? I also need to ensure that the selection is 1 column * multiple rows (that is, the range should only stack vertical where the column no. should be the same). I could do this if I get the first and the last cells in the range and checking if the column is same, but I'm not sure how this is done..

PS: I tried looking at the documentation for Selection, Areas etc. but couldn't clearly understand what needs to be used.

Any help would be appreciated.

Thanks in advance