Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Run macro problem

I want to call a macro from the Worksheet Deactivate
event, my problem is that I want the macro to carry out
calculations on the active sheet. Is there any way to
include anything in the Deactivate event that will switch
back to the previously active sheet and run the macro.

For example:
Sheet1 is active and I click on Sheet2 which contains a
summary of data on Sheet1, the macro needs to run so that
the data on Sheet2 is updated (macro cannot be run from
the activate event of sheet2).

Thanks in advance.

Gareth

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Run macro problem

Something like this?

Private Sub Worksheet_Deactivate()
With ActiveSheet
.Range("J11").Value = Application.Sum(.Range("A1:J10"))
End With
End Sub


In article ,
"Gareth" wrote:

I want to call a macro from the Worksheet Deactivate
event, my problem is that I want the macro to carry out
calculations on the active sheet. Is there any way to
include anything in the Deactivate event that will switch
back to the previously active sheet and run the macro.

For example:
Sheet1 is active and I click on Sheet2 which contains a
summary of data on Sheet1, the macro needs to run so that
the data on Sheet2 is updated (macro cannot be run from
the activate event of sheet2).

Thanks in advance.

Gareth

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
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Macro problem Jim New Users to Excel 2 March 16th 05 07:36 PM
Problem with a macro OldRod Excel Programming 3 July 27th 04 05:24 PM
My Macro problem Al Jager Excel Programming 1 January 28th 04 11:35 PM


All times are GMT +1. The time now is 03:19 AM.

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"