I have three workbooks all in SharePoint folders. The main Workbook has a macro to open the other two Workbooks. The Hyperlinks to the other two Workbooks is in a tab called "Data". I have the following macro that works fine for opening the two other Workbooks but I want it to return to the original workbook and have a code at the end for it (highlighted in red) but it does not run, the last Workbook opened stays active. If I run the last line as a separate macro it works fine. Any ideas?
Sub Open_workbook()
Dim xHyperlink As Hyperlink
Dim WorkRng As Range
On Error Resume Next
'Set Range
Sheets("Data").Activate
Range("Data_Weekly_Spreadsheet:Data_Job_Log").Select
Set WorkRng = Application.Selection
For Each xHyperlink In WorkRng.Hyperlinks
xHyperlink.Follow
Next
Windows("JPR - Monthly Tracker 2022 - w Ext Links.xlsm").Activate
End Sub
Thanks
Sub Open_workbook()
Dim xHyperlink As Hyperlink
Dim WorkRng As Range
On Error Resume Next
'Set Range
Sheets("Data").Activate
Range("Data_Weekly_Spreadsheet:Data_Job_Log").Select
Set WorkRng = Application.Selection
For Each xHyperlink In WorkRng.Hyperlinks
xHyperlink.Follow
Next
Windows("JPR - Monthly Tracker 2022 - w Ext Links.xlsm").Activate
End Sub
Thanks