View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy Doug Glancy is offline
external usenet poster
 
Posts: 770
Default Is there a way to call selected sheet's name from on deactivate event?

Since the Deactivate event fires before the Activate event, it seems like
you might have to do it the other way around, i.e., trap the deactivated
sheet name in the Activate event:

Option Explicit
Dim deactivated As Worksheet

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Set deactivated = Sh.Name
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
MsgBox deactivated.Name
End Sub

hth,

Doug Glancy

"Wandering Mage" wrote in message
...
I am using a Workbook Level Sheet Deactivate Event. I
need to know the name of the sheet that I am trying to
select. Is there anyway to call out this name? Thanks.