I have a macro that iterate through folders and use the “dir”-function to find out if a file exist in the active folder, and puts the filename in a cell.
The problem is that it might be two or more files satisfies the search.
Dir(subfolder & "\Kommunesvar*")
How can I get both two results in a specified subfolder if there are two files starting with “Kommunesvar”? Dir returns the filename, but I want both.
How are you using
DIR. The below code will give you all the files which start withKommunesvarand are Excel Files.If you want to store all the files names in one variable then you can use this as well.