After I run a macro(which selects records from sql server, no reference to another workbook), one of the other open workbooks is randomly activate.
The macro is in book1, I run the macro from book1.
At the end, book2(or book3 etc) is activate. Why ?!
I tried to put just before End Sub
Dim Wb As Workbook
Set Wb = Active/ThisWorkbook
Wb.Activate
or
msgbox "ok"
but still fly to another open workbook(the message box pop up on book2)
This thing not happens every time, just sometimes, randomly.
Thank you
update: Since I fixed a cirrcular refference in book2, seems to stop.

Debug.Print Wb.Namereturns ? - Stupid_InternSet Wb = ActiveworkbookSets Wb variable to the workbook which is active just before running the macro. UseSet Wb = ThisWorkbookInstead. - Stupid_Intern