How to run a Macro on Deactivating Sheet?

Exel4life

New Member
Joined
Apr 25, 2011
Messages
1
I have a simple Macro I run on my sheets.
I want it to run each time I Deactivate a Sheet but I don't know how to make it happen.
Can anyone help?
Here is the code
****************

Sub Refresh_Page()
'
' Refresh_Page Macro
'

'
Range("Q8:s8").Select
Selection.AutoFill Destination:=Range("Q8:s58"), Type:=xlFillDefault
Range("Q8:s58").Select
End Sub

*****************
I do have some sheets I won't want it to run on.
 

Some videos you may like

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

tusharm

MrExcel MVP
Joined
May 28, 2002
Messages
11,007
Use the Worksheet_Deactivate event.

I have a simple Macro I run on my sheets.
I want it to run each time I Deactivate a Sheet but I don't know how to make it happen.
Can anyone help?
Here is the code
****************

Sub Refresh_Page()
'
' Refresh_Page Macro
'

'
Range("Q8:s8").Select
Selection.AutoFill Destination:=Range("Q8:s58"), Type:=xlFillDefault
Range("Q8:s58").Select
End Sub

*****************
I do have some sheets I won't want it to run on.
 

Watch MrExcel Video

Forum statistics

Threads
1,099,030
Messages
5,466,121
Members
406,468
Latest member
Toto Li

This Week's Hot Topics

Top