View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default What was ActiveSheet before changed to new sheet?

Working OK here.
2 sheets, in the sheet1 code module:

Private Sub Worksheet_Activate()
MsgBox "activate", , "sheet1"
End Sub

Private Sub Worksheet_Deactivate()
MsgBox "de-activate", , "sheet1"
End Sub

in the sheet2 code module:

Private Sub Worksheet_Activate()
MsgBox "activate", , "sheet2"
End Sub

Private Sub Worksheet_Deactivate()
MsgBox "de-activate", , "sheet2"
End Sub

First I get the Deactivate from the sheet I came from, then the Activate
event
from the sheet I went to. Try for yourself.


RBS


"Tom L" wrote in message
...
I've been searching for hours, can't find a solution but it's probably
simple...how can I tell what sheet was the ActiveSheet BEFORE they changed
to the current activesheet.

Example: User is on a particular sheet (let's say they're on "Main"),
then they click the tab to go to the "Prices" sheet. How can I tell what
sheet they're comming FROM - in this case the "Main" sheet? In the
Workbook and the Worksheet events Activate and Deactivate, I check the
Sheet parameter (SH) and it always shows "Prices", the sheet they're going
too.

Thanks for your help!