First of all, excuse me if the code below does not contain an array but a list. I am new to VBA so I don't know all the basics yet. The code below retrieves an array (or a list) of all Excel files in a certain folder. The code is used to retrieve data from each file and is pasted in a master file.
Okay, here is my MWE:
Sub ReadDataFromAllWorkbooksInFolder()
Dim FolderName As String, wbName As String, wbCount As Integer
FolderName = "C:\Users\Robin\Desktop\Test"
wbCount = 0
wbName = Dir(FolderName & "\" & "*.xlsm")
While wbName <> ""
wbCount = wbCount + 1
ReDim Preserve wbList(1 To wbCount)
wbList(wbCount) = wbName
wbName = Dir
Wend
If wbCount = 0 Then Exit Sub
End Sub
Now here is the problem: The array contains a template file, and the name of the file contains the word TEMPLATE. How do I filter out (or exclude) the file which file name contains the string "TEMPLATE"?
Any help would be much appreciated! Thanks in advance!