Hi Guys,
I am having an issue where the macro runs but once it opens another workbook, it just stops at
Once the second workbook has been opened, the active workbook
is the workbook I would like active.
I initially had this in a worksheet to run when a cell changed and I experienced this issue. I then moved it to a module to be executed via a button but the same issue.
I am unsure how to proceed, any thoughts?
The full macro:
Cheers,
Shaun
I am having an issue where the macro runs but once it opens another workbook, it just stops at
Code:
Workbooks.Open OpenFile
Code:
WBName
I initially had this in a worksheet to run when a cell changed and I experienced this issue. I then moved it to a module to be executed via a button but the same issue.
I am unsure how to proceed, any thoughts?
The full macro:
Code:
Sub ()
Dim File As Workbook
Dim OpenFile As String
Dim WBName As String
WBName = ActiveWorkbook.name
OpenFile = Application.ActiveWorkbook.Path & "\Data\" & ActiveSheet.Range("$B$1").Value & ".xlsx"
Application.ScreenUpdating = False
If Workbooks.Count > 1 Then
For Each File In Application.Workbooks
If Not (File Is Application.ActiveWorkbook) Then
File.Save
File.Close
Workbooks.Open OpenFile
End If
Next
Else
Workbooks.Open OpenFile
End If
Windows(WBName).Activate
Application.ScreenUpdating = True
End Sub
Cheers,
Shaun