Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default Event sometimes stops firing?

I have code that is run when you do a cell change "Worksheet_Change"
normally everything seems to work fine but once and a while the code just
decides to stop firing. The only way to get it working again is to manually
fire the "Worksheet_Change" event. Any ideas?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Event sometimes stops firing?

As a WAG in your code somewhere you are using

Application.EnableEvents = false

As a guess the corresponding

Application.EnableEvents = true

is missing or your sub exits/ends prior to running that line of code... The
other possibility is that you have generated an error which halts the code
prior to turning the events back on.

HTH


"HotRod" wrote:

I have code that is run when you do a cell change "Worksheet_Change"
normally everything seems to work fine but once and a while the code just
decides to stop firing. The only way to get it working again is to manually
fire the "Worksheet_Change" event. Any ideas?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Event sometimes stops firing?

Sounds like you disable events in your code and don't properly reenable
them. Perhaps if you posted the code, someone could give you a clue.

--
Regards,
Tom Ogilvy


"HotRod" wrote in message
...
I have code that is run when you do a cell change "Worksheet_Change"
normally everything seems to work fine but once and a while the code just
decides to stop firing. The only way to get it working again is to

manually
fire the "Worksheet_Change" event. Any ideas?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default Event sometimes stops firing?

I've actually turned of all of the Application.EnableEvents = false code in
my code, I'm wondering if an error will cause this problem? Is it possible
that an error is occurring that just jumps out of the macro?

One other question I've been googling for an example of how to Sort more
than three columns at a time and depending on where I look some sites say
that it's not possible. This is the code I'm using below.


Range("A" & First_Data_Row & ":AA55550").Sort Key1:=Range(First_Column &
First_Data_Row), _
Order1:=xlAscending, Key2:=Range(Second_Column & First_Data_Row), _
Order2:=xlAscending, Key3:=Range(Third_Column & First_Data_Row), _
Order3:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Event sometimes stops firing?

Excel uses a persistent sort. You can sort on all 256 columns if you like,
but you have to sort 3 at a time. Start with the least significant to the
most significant.

--
Regards,
Tom Ogilvy



"HotRod" wrote in message
...
I've actually turned of all of the Application.EnableEvents = false code

in
my code, I'm wondering if an error will cause this problem? Is it possible
that an error is occurring that just jumps out of the macro?

One other question I've been googling for an example of how to Sort more
than three columns at a time and depending on where I look some sites say
that it's not possible. This is the code I'm using below.


Range("A" & First_Data_Row & ":AA55550").Sort Key1:=Range(First_Column &
First_Data_Row), _
Order1:=xlAscending, Key2:=Range(Second_Column & First_Data_Row),

_
Order2:=xlAscending, Key3:=Range(Third_Column & First_Data_Row), _
Order3:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Event sometimes stops firing?

Do you turn the events back on by setting

Application.EnableEvents = true

at the end of the procedure? This needs to be done otherwise events are off
until you explicitly turn them back on... Post your code.

As for sorting Tom is correct. If you want to sort by Column A then B then C
then D then E then F, just do it in reverse. Sort By F then E then D then C
then B then A. If that does not make sense then just reply.

HTH

"HotRod" wrote:

I've actually turned of all of the Application.EnableEvents = false code in
my code, I'm wondering if an error will cause this problem? Is it possible
that an error is occurring that just jumps out of the macro?

One other question I've been googling for an example of how to Sort more
than three columns at a time and depending on where I look some sites say
that it's not possible. This is the code I'm using below.


Range("A" & First_Data_Row & ":AA55550").Sort Key1:=Range(First_Column &
First_Data_Row), _
Order1:=xlAscending, Key2:=Range(Second_Column & First_Data_Row), _
Order2:=xlAscending, Key3:=Range(Third_Column & First_Data_Row), _
Order3:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default Event sometimes stops firing?

I will give it a try.

THANKS


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Event sometimes stops firing?

Also, don't forget that if you are either stepping through your code or it
errors out *before* you turn events back on, you will need to do so
manually. If this is the case, you may use a routine, something like ...

Sub ResetAppAttributes()
With Application
.Screenupdating = True
.Displayalerts = True
.Enableevents = true
.Statusbar = False
.CutCopyMode = False
End with
End Sub

Or something like that. HTH

--
Regards,
Zack Barresse, aka firefytr

"HotRod" wrote in message
...
I've actually turned of all of the Application.EnableEvents = false code
in
my code, I'm wondering if an error will cause this problem? Is it possible
that an error is occurring that just jumps out of the macro?

One other question I've been googling for an example of how to Sort more
than three columns at a time and depending on where I look some sites say
that it's not possible. This is the code I'm using below.


Range("A" & First_Data_Row & ":AA55550").Sort Key1:=Range(First_Column &
First_Data_Row), _
Order1:=xlAscending, Key2:=Range(Second_Column & First_Data_Row), _
Order2:=xlAscending, Key3:=Range(Third_Column & First_Data_Row), _
Order3:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom




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
Code for App level event (not firing) Chris W[_3_] Excel Programming 2 February 28th 05 02:57 AM
Stop Worksheet_SelectionChange event from firing? Ed Excel Programming 13 January 5th 05 12:57 PM
Worksheet change event not firing Wexler Excel Programming 11 October 25th 04 09:45 PM
Workbook open event not firing (both 2000 and XP) Greg Lesnie Excel Programming 2 October 17th 04 10:31 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


All times are GMT +1. The time now is 04:05 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"