Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run a macro when changing the sheet

I would like a macro to run every time the user changes of sheet.
Not when a cell is selected or changed, but immediately after changing the
sheet.
I want it to run also when a new sheet is added to the workbook.

Thank you in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Run a macro when changing the sheet



Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)

Put your macro here

End Sub

"S. G." wrote:

I would like a macro to run every time the user changes of sheet.
Not when a cell is selected or changed, but immediately after changing the
sheet.
I want it to run also when a new sheet is added to the workbook.

Thank you in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Run a macro when changing the sheet

Put these in ThisWorkbook

Private Sub Workbook_NewSheet(ByVal Sh As Object)
MsgBox ("New")
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
MsgBox ("Activated :") & Sh.Name
End Sub



"Mike" skrev:



Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)

Put your macro here

End Sub

"S. G." wrote:

I would like a macro to run every time the user changes of sheet.
Not when a cell is selected or changed, but immediately after changing the
sheet.
I want it to run also when a new sheet is added to the workbook.

Thank you in advance.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
changing sheet size mmap hq New Users to Excel 4 July 8th 09 08:48 PM
Changing the name of a sheet Cole C. Excel Discussion (Misc queries) 1 April 21st 09 08:03 PM
changing tab name on the bottom of an Excel sheet by macro cinders Excel Programming 1 November 15th 06 12:53 PM
Changing target sheet name wihtin a macro Jim G Excel Discussion (Misc queries) 2 January 30th 06 03:05 AM
Changing Sheet Name Andym Excel Programming 1 February 1st 05 04:02 PM


All times are GMT +1. The time now is 11:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"