Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub marine()
Dim prev As String prev = ActiveSheet.Previous.Name End Sub Mike F "Spike" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy Sheet causes Combo Box change event to fire on original sheet | Excel Programming | |||
change sheet position right to left | Excel Discussion (Misc queries) | |||
Return to Current Sheet in On (sheet activate) event macro | Excel Programming | |||
Sheet Name Change Event? | Excel Programming | |||
Sheet Name Change Event? | Excel Programming |