I have code which runs on one workbook and starts by referencing 1 other open workbook, which could have any name, I want to switch to the other open workbook by using the index number for this reason.
Users could open the workbook containing code first or the other workbook first, so I want to be able to say something like IF index of the active sheet is 1, then Workbooks(2).Activate, but if the index of the active sheet is 2, then Workbooks(1).Activate, thank you.
I have this code to make sure there are only 2 books open already;
If Workbooks.Count > 2 Then
MsgBox "Have ONLY the new data file and this open before running :)"
Exit Sub
End If
activewindow.ActivateNext
to switch from one to the other. – Rory