Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return Array from Function
I have the following function that works fine, unless I add arguements.
When I add the arguments I get a Run-Time error '13': Type mismatch. Any help would be greatly appreciated. Option Base 1 Function FileSearch(Directory As String, Criteria As String) Dim aFiles() With Application.FileSearch .NewSearch .LookIn = Directory 'ActiveWorkbook.Worksheets("Control").Cells(3, 2) 'Directory .SearchSubFolders = True .Filename = Criteria ' ActiveWorkbook.Worksheets("Control").Cells(4, 2) 'Criteria .Execute ReDim aFiles(.FoundFiles.Count) For i = LBound(aFiles) To UBound(aFiles) aFiles(i) = .FoundFiles(i) Debug.Print i, aFiles(i) Next i End With 'FileSearch = Application.WorksheetFunction.Transpose(aFiles) FileSearch = aFiles End Function |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Return Array from Function
Gary,
Thank you worked like a charm. I will be sure not to use reserved words in the future. Thanks again, John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Reverse a function to return the array? | Excel Worksheet Functions | |||
Which Function to Use? Search an Array, Return a Row Value | Excel Discussion (Misc queries) | |||
Using INDEX function to return array row. | Excel Worksheet Functions | |||
Return array from worksheet function | Excel Worksheet Functions | |||
Return an array of values from a function | Excel Programming |