I have this code to loop through some cells of a workbook (wb), and if they are formatted as bold, to open a specific file (wb1), save it with another filename (FinFil) and run macro1 in it. Macro1 closes FinFil .
It works ok with the first bold cell, but then it stops...
any ideas?
It works ok with the first bold cell, but then it stops...
any ideas?
Code:
With wb
.Sheets(1).Calculate
For Each cel In .Sheets(1).Range("f12:f1111")
If Trim(cel) <> "" And cel.Font.Bold = True Then
filName = .Sheets(1).Range("b10") & "\" & .Sheets(1).Range("b14")
Select Case Dir(filName)
Case ""
MsgBox "Could not find file: " & filName
Case Else
Set wb1 = Workbooks.Open(filName)
With wb1
FinFil = .Sheets("PROFILE").Range("c1")
.SaveAs Filename:=FinFil, FileFormat:=52
Application.Run ("'" & FinFil & "'!macro1")
Set wb1 = Nothing
End With
End Select
End If
Next cel
End With