title: VBA to store file name in a cell
body: <p>I am trying to target the file name/directory to a cell in excel which I have chosen by a ms file dialog box. So far I have managed to do it for one file but if i multi-select the files it doesn't store all the file names sequentially instead it just does only the first file.</p>
  
  <pre><code> With fd
            .AllowMultiSelect = True
  .Filters.Clear
  .Filters.Add "All files", "*.*", 1
  .Filters.Add "SIG Files", "*.SIG"
  .Filters.Add "FLG Files", "*.FLG"
  .Filters.Add "TCS Files", "*.TCS"
  .Filters.Add "ROU Files", "*.ROU"
  .Filters.Add "PTS Files", "*.PTS"
  .Filters.Add "QST Files", "*.QST"
  .FilterIndex = 1
  .Title = "Select SSI Identity File"
  .InitialFileName = ""
    If .Show = -1 Then
    ReDim selectedPaths(.SelectedItems.Count)
  
  
          For I = 0 To .SelectedItems.Count - 1
          selectedPaths(I) = .SelectedItems(I + 1)
  
  
                   lRow = Cells(Rows.Count, 54).End(xlUp).Row
  
         Z = lRow + 1
  
             **Range("BA5").Offset(I, 0).Value = selectedPaths(I)**
  </code></pre>
  
  <p>I wanted to fill range BA5 with file names/directories sequentially as my fdbox allows multi select option.</p>
  
  <p>Appreciate if anyone could help.</p>