Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Excel macro to detect which tab has been selected?

I'm doing a bit of messing about in VB for a macro I'm making in Excel. Is there any way of detecting when a user has selected a sheet with the tabs on the bottom left in Excel 2007, and determining which tab they've selected? I hoping that there might be something like the Worksheet_SelectionChange event but for tabs!

Update:

Variable = ActiveSheet.Name

Will indeed record the sheet name in a variable, but what I'm after is an event trigger which will activate and can be used to run a sub once the active sheet has been changed.

Worksheet_SelectionChange will trigger if the user changes the active cell, I'm looking for a function which will trigger if the user changes the active sheet.

Update 2:

Found the function I was looking for:

Workbook_SheetActivate

http://dmcritchie.mvps.org/excel/event.htm#wb_shtC...

1 Answer

Relevance
  • 8 years ago
    Favorite Answer

    Yes:

    Variable = ActiveSheet.Name

Still have questions? Get your answers by asking now.