Hey!

Let's say you have two workbooks opened and you want to run a macro everytime the "workbook 2" is deactivated. However, the macro should make some changes to this deactivated "workbook 2" and then deactivate it again. But this scenario obviously creates an infinite loop.

My "workbook 2" code looks like this:

Private Sub Workbook_Deactivate()
    Windows("Workbook2.xlsm").Activate
    Call MyMacro
End Sub
My Macro:

Sub MyMacro()
    Range("G29:G120").Copy
    Range("AU29").PasteSpecial
    Application.CutCopyMode = False
    ActiveWindow.Visible = False
End Sub
Is it possible to make it work without this unwanted loop?

Thanks for any advice!

Lukas