View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Sheet change event to return sheet name just left

Thank you for the feedback
--
Gary''s Student - gsnu201003


"Spike" wrote:

That is grand, mnay thanks works a dream
--
with kind regards

Spike


"Gary''s Student" wrote:

We need to remember it. In a standard module:

Public OldSheet As String
Public NewSheet As String

In the worksheet code area of every sheet:


Private Sub Worksheet_Activate()
If IsEmpty(OldSheet) Then
OldSheet = "x"
End If
MsgBox OldSheet
OldSheet = ActiveSheet.Name
End Sub

--
Gary''s Student - gsnu201003


"Spike" wrote:

Does anyone have any idea how I can get the name of a worksheet that I have
just moved from. So if I am in Sheet1 and move to Sheet2, how do I get a
macro to return Sheet1. In all the Events I have looked at they all return
the name of the sheet that I have moved to not the sheet I have left.

Any help will be gratefully received

--
with kind regards

Spike