Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Calling a module only when a sheet is actually "activated"

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Calling a module only when a sheet is actually "activated"

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Calling a module only when a sheet is actually "activated"

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Calling a module only when a sheet is actually "activated"

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" wrote in
message ...
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
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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
Change default in input box from "20" to "000000"? Have macro continue on to name sheet tab? StargateFanFromWork[_4_] Excel Programming 7 October 29th 06 11:46 AM
Please add a "sheet" function like "row" and "column" functions Spreadsheet Monkey Excel Programming 2 November 8th 05 04:08 PM
Sheet turns into a "ThisWorkbook" module Rob Excel Programming 3 March 15th 05 01:33 PM


All times are GMT +1. The time now is 03:43 PM.

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

About Us

"It's about Microsoft Excel"