trace worksheet activate event
Sub Worksheet_Activate() Dim msgOutput As String msgOutput = "This worksheet is " & Workheets(2).Name MsgBox (msgOutput) End Sub