Thus, the spreadsheet I'm using has a folder location in cell E22 and a blank cell in cell D22. I want to output all of the files to a blank space after reading the folder path (in E22) (in D22). However, it appears that all that I have is returning is the error message that I specified.
Side Note: Would anything change for network locations?
This is what I have:
Function GetAllFileNames(ByVal FolderPath As String) As Variant
Dim Result As Variant
Dim FileName As Variant
Dim i As Integer
FileName = Dir(FolderPath)
i = 1
Do While FileName <> ""
Result(i) = FileName
i = i + 1
FileName = Dir()
Loop
GetAllFileNames = Result
End Function
Sub GAFN()
End Sub
And then in the cell I want to insert the result into I have this:
=IFERROR(INDEX(GetAllFileNames($E$22),ROW()),"na")
Anyone can point me in the right direction?