How to make inactive when I close application window by Command + W When I open an Excel file from Finder and close the Excel window by Command+W. The active window remain Excel.

Is there a way to make Finder active window when I close Excel?

If I close the Excel window by Command+Q, the Finder become active but I prefer to keep Excel in memory.
I'm not sure you can really have both…

Telling Excel to close a window doesn't tell Excel to quit. It doesn't actually tell it anything other than you closed a window. It sits there waiting for you to tell it what to do next; it can't guess what your next action is going to be.

Of course, if you Quit it, then it goes away &amp; the last-used app will be frontmost.

Clicking the desktop is the quickest way to bring the Finder to the front.