Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way to run a particular macro when focus is change from a
particular worksheet to any other worksheet by selecting another worksheet? Thanks for your help. Jim Walsh |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub Worksheet_Deactivate()
....your code End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- __________________________________ HTH Bob "jswalsh33" wrote in message ... Is there a way to run a particular macro when focus is change from a particular worksheet to any other worksheet by selecting another worksheet? Thanks for your help. Jim Walsh |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
DeActivate event is triggered when you select another worksheet..
Private Sub Worksheet_Deactivate() MsgBox "ok" End Sub If this post helps click Yes --------------- Jacob Skaria "jswalsh33" wrote: Is there a way to run a particular macro when focus is change from a particular worksheet to any other worksheet by selecting another worksheet? Thanks for your help. Jim Walsh |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If the two worksheets are in separate workbooks, you may want to use the
workbook event: Private Sub Workbook_Deactivate() (maybe both????) jswalsh33 wrote: Is there a way to run a particular macro when focus is change from a particular worksheet to any other worksheet by selecting another worksheet? Thanks for your help. Jim Walsh -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob,
That works good, but it allows the newly selected worksheet to be activated before the the Deactivate code operates. I tried putting in "Application.ScreenUpdating = False" as the first line of code but that did not prevent it. Is there a way to keep the screen from switching to the newly selected worksheets? Thanks Again, Jim Walsh "Bob Phillips" wrote: Private Sub Worksheet_Deactivate() ....your code End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- __________________________________ HTH Bob "jswalsh33" wrote in message ... Is there a way to run a particular macro when focus is change from a particular worksheet to any other worksheet by selecting another worksheet? Thanks for your help. Jim Walsh |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I can't see it because that sheet is not deactivated until something else is
activated. -- __________________________________ HTH Bob "jswalsh33" wrote in message ... Bob, That works good, but it allows the newly selected worksheet to be activated before the the Deactivate code operates. I tried putting in "Application.ScreenUpdating = False" as the first line of code but that did not prevent it. Is there a way to keep the screen from switching to the newly selected worksheets? Thanks Again, Jim Walsh "Bob Phillips" wrote: Private Sub Worksheet_Deactivate() ....your code End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- __________________________________ HTH Bob "jswalsh33" wrote in message ... Is there a way to run a particular macro when focus is change from a particular worksheet to any other worksheet by selecting another worksheet? Thanks for your help. Jim Walsh |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Create new workbook and new worksheet and close. Worksheet not saved | Excel Programming | |||
Create new workbook and new worksheet and close. Worksheet not sav | Excel Programming | |||
Create new workbook and new worksheet and close. Worksheet not sav | Excel Worksheet Functions | |||
Copy & paste cells fr open worksheet then close the worksheet | Excel Programming | |||
How to sum value from master worksheet taking value from other close worksheet | Excel Programming |