instead of "like", the function you're looking for is Instr()
so, your macro should look something like:
Sub Test()
Dim wb As Workbook
Dim DestinationFile As String, SourceFile As String
For Each wb In Workbooks
If (InStr(1, wb.Name, "D") > 0) Then
DestinationFi
Hi All,
I am trying to browse through all open workbooks and assign their names to
variables based on some pattern. Below is the code I have written:
Sub Test()
Dim wb As Workbooks
For Each wb In WorkbooksIf Workbook.Name Like "*123*" Then
DestinationFile = ActiveWorkbook.NameElseI