I have a macro that is invoked when leaving a tab (deactivate), to
clear off some data and do some other functions on that sheet, before
moving to other sheets.

I want to capture the tab that was selected, and then at the end of the
macro, auto select the sheet that they clicked.

Can someone please give me the command for capturing the clicked sheet?

Thanks