I am having an issue calling/activating a workbook(s) utilizing wildcards, from my main workbook, i.e. (MAP) I have it set up so that the MAP workbook will open all other workbooks in a folder utilizing names such as m1, m2, m3 etc...
The wildcard that I state is "m*.htm" in the code. This is working fine, all "M" named files open and it executes a piece of code on that particular workbook and moves onto the next workbook name "M". Here is where I hit a wall and cannot get it to work.
The line of code I have is this:
Windows("MAP Report Lite-Test Phase").Activate
Dim LastRow As Long
With Worksheets("Summary")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
With .Range("D34
" & LastRow)
.Formula = "=IF(ISERROR(INDEX('-*.htm'!$E:$E,MATCH(C34,'-*.htm'!$A:$A,0))),"""",INDEX('-*.htm'!$E:$E,MATCH(C34,'-*.htm'!$A:$A,0)))"
.Value = .Value
End With
End With
The error resides in the formula. I can "hard" name each file, but then I have to change it manually. I need to "read" the wildcard, so I don't have to do this...
I have tried every variation that I can think of to "call" the "m*.htm" workbook inside the "Summary" worksheet, which is in the MAP workbook to no avail.
The number of "m*" named files will vary each time, so I need it to work as the same as my opening line...find all related files named "m*"
Any help would be greatly appreciated,
Hans
The wildcard that I state is "m*.htm" in the code. This is working fine, all "M" named files open and it executes a piece of code on that particular workbook and moves onto the next workbook name "M". Here is where I hit a wall and cannot get it to work.
The line of code I have is this:
Windows("MAP Report Lite-Test Phase").Activate
Dim LastRow As Long
With Worksheets("Summary")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
With .Range("D34
.Formula = "=IF(ISERROR(INDEX('-*.htm'!$E:$E,MATCH(C34,'-*.htm'!$A:$A,0))),"""",INDEX('-*.htm'!$E:$E,MATCH(C34,'-*.htm'!$A:$A,0)))"
.Value = .Value
End With
End With
The error resides in the formula. I can "hard" name each file, but then I have to change it manually. I need to "read" the wildcard, so I don't have to do this...
I have tried every variation that I can think of to "call" the "m*.htm" workbook inside the "Summary" worksheet, which is in the MAP workbook to no avail.
The number of "m*" named files will vary each time, so I need it to work as the same as my opening line...find all related files named "m*"
Any help would be greatly appreciated,
Hans