PC Review


Reply
Thread Tools Rate Thread

Calling a module only when a sheet is actually "activated"

 
 
=?Utf-8?B?TWF1cnkgTWFya293aXR6?=
Guest
Posts: n/a
 
      21st Aug 2007
I have some code that is triggered when the user selects a sheet within a
workbook. It redraws a menu, which changes from sheet to sheet.

The problem is that this takes some time to run, and when you're running
functions that cycle through the sheets (and we have lots of these) the delay
while the menu redraws actually becomes a significant time waster.

So what I'd like to do is have this code fire not when the workbood simply
changes tabs, but when the USER does this. Any ideas?

Maury
 
Reply With Quote
 
 
 
 
=?Utf-8?B?cDQ1Y2Fs?=
Guest
Posts: n/a
 
      21st Aug 2007
2 suggestions:
1. 99% of code does not needto activate/select anything, so change your code
to reflect this (post a small section of your code and I/someone will show
you the equivalent).
2. Use Application.EnableEvents=False/True carefully.
--
p45cal


"Maury Markowitz" wrote:

> I have some code that is triggered when the user selects a sheet within a
> workbook. It redraws a menu, which changes from sheet to sheet.
>
> The problem is that this takes some time to run, and when you're running
> functions that cycle through the sheets (and we have lots of these) the delay
> while the menu redraws actually becomes a significant time waster.
>
> So what I'd like to do is have this code fire not when the workbood simply
> changes tabs, but when the USER does this. Any ideas?
>
> Maury

 
Reply With Quote
 
=?Utf-8?B?Sm9obiBCdW5keQ==?=
Guest
Posts: n/a
 
      21st Aug 2007
Don't think you can trap for (or would want to ) when just the user changes
at the beginning of your code put in application.screenupdating=false and
change back to true at end, untested but i believe that will keep any menus
from drawing.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Maury Markowitz" wrote:

> I have some code that is triggered when the user selects a sheet within a
> workbook. It redraws a menu, which changes from sheet to sheet.
>
> The problem is that this takes some time to run, and when you're running
> functions that cycle through the sheets (and we have lots of these) the delay
> while the menu redraws actually becomes a significant time waster.
>
> So what I'd like to do is have this code fire not when the workbood simply
> changes tabs, but when the USER does this. Any ideas?
>
> Maury

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      21st Aug 2007
Just create a public variable which the worksheet event routine tests for,
and set and reset in your looping code, or even use
Application.EnableEvents.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Maury Markowitz" <(E-Mail Removed)> wrote in
message news:8EBE245E-FABF-435D-A778-(E-Mail Removed)...
>I have some code that is triggered when the user selects a sheet within a
> workbook. It redraws a menu, which changes from sheet to sheet.
>
> The problem is that this takes some time to run, and when you're running
> functions that cycle through the sheets (and we have lots of these) the
> delay
> while the menu redraws actually becomes a significant time waster.
>
> So what I'd like to do is have this code fire not when the workbood simply
> changes tabs, but when the USER does this. Any ideas?
>
> Maury



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Compile Error: ByRef argument type mismatch" when calling my function from another module ker_01 Microsoft Excel Programming 2 14th Aug 2008 03:53 PM
Can't "Call" Error Handler in Standard Module from Form Module =?Utf-8?B?Sm9obiBE?= Microsoft Access VBA Modules 8 21st Apr 2007 07:24 PM
adp module error at "0x77f58ddf" referenced memory at "0x32017800" =?Utf-8?B?TWF0dEw=?= Windows XP Help 1 11th May 2006 01:44 AM
HELP!- "You cancelled the previous action"-"Module not found" =?Utf-8?B?cmljaw==?= Microsoft Access 2 16th Mar 2005 05:01 PM
Sheet turns into a "ThisWorkbook" module =?Utf-8?B?Um9i?= Microsoft Excel Programming 3 15th Mar 2005 01:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:20 PM.