I have the following macro to open a workbook and then to fo to a named cell on a sheet
However when running the macro, the workbook closes
If I manually open the soource workbook and then run the macro, The workbook does not close. I suspect that this portion of the code is causing the issue
It would be apreciated if someone could amend my code to prevent file closing down unexpectently
However when running the macro, the workbook closes
If I manually open the soource workbook and then run the macro, The workbook does not close. I suspect that this portion of the code is causing the issue
Code:
Windows("STATS BR ales.xls").Activate
Sheets("Sales Acc Numbers").Select
Application.Goto Reference:="Sales"
Code:
Sub Open_SalesFile()
ChDir "C:\My Documents"
Dim A As Variant
Dim LR As Long
MsgBox "Select Current Years Sales File"
If TypeName(A) = "Boolean" Then Exit Sub
Dim FileAry As Variant, Fle As Variant
With Application.FileDialog(3)
.InitialFileName = "C:\My Documents\"
.AllowMultiSelect = True
.InitialFileName = "Sales.*.xls*"
If .Show Then Set FileAry = .SelectedItems()
End With
For Each File In FileAry
If TypeName(A) = "Boolean" Then Exit Sub
With Workbooks.Open(File)
End With
Next
Windows("STATS BR ales.xls").Activate
Sheets("Sales Acc Numbers").Select
Application.Goto Reference:="Sales"
End Sub
It would be apreciated if someone could amend my code to prevent file closing down unexpectently