Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Deactivating Multipage Change Event

I have the following code in a UserForm....

Sub Multipage1_Change()
If UserForm1.ListBox2.ListCount = 0 And UserForm1.Multipage1.Value 0
Then
Application.EnableEvents = False
UserForm1.Multipage1.Value = 0
MsgBox "Please make selection"
End If
End Sub

However when I "watch" this process, I notice that even though the
Application.EnableEvents = False executes, when I go to set the
UserForm back to Multipage1.Value = 0, the subroutine treats it like a
change and goes back to the top again.

Is there something special I have to do temporarily deactivate an event
in a userform? or a change event?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 280
Default Deactivating Multipage Change Event

see embedded

" wrote in message
...
I have the following code in a UserForm....

Sub Multipage1_Change()


Static blnIgnoreChange As Boolean
If blnIgnoreChange Then Exit Sub
blnIgnoreChange = True

If UserForm1.ListBox2.ListCount = 0 And UserForm1.Multipage1.Value 0
Then
Application.EnableEvents = False
UserForm1.Multipage1.Value = 0
MsgBox "Please make selection"
End If


blnIgnoreChange = False


End Sub

However when I "watch" this process, I notice that even though the
Application.EnableEvents = False executes, when I go to set the
UserForm back to Multipage1.Value = 0, the subroutine treats it like a
change and goes back to the top again.

Is there something special I have to do temporarily deactivate an event
in a userform? or a change event?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Deactivating Multipage Change Event

Use a boolean variable and keep track yourself:

Dim blkProc as boolean
Sub Multipage1_Change()
if blkproc then exit sub
If UserForm1.ListBox2.ListCount = 0 And UserForm1.Multipage1.Value 0 Then
blkproc = true
UserForm1.Multipage1.Value = 0
blkproc = false
MsgBox "Please make selection"
End If
End Sub

" wrote:

I have the following code in a UserForm....

Sub Multipage1_Change()
If UserForm1.ListBox2.ListCount = 0 And UserForm1.Multipage1.Value 0
Then
Application.EnableEvents = False
UserForm1.Multipage1.Value = 0
MsgBox "Please make selection"
End If
End Sub

However when I "watch" this process, I notice that even though the
Application.EnableEvents = False executes, when I go to set the
UserForm back to Multipage1.Value = 0, the subroutine treats it like a
change and goes back to the top again.

Is there something special I have to do temporarily deactivate an event
in a userform? or a change event?


--

Dave Peterson

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
Deactivating worksheets Keri[_2_] Excel Programming 3 August 31st 04 04:50 PM
Change the background color on a multipage control? Candee[_31_] Excel Programming 1 August 25th 04 10:08 PM
Chart Values that change based on Change event ExcelMonkey[_119_] Excel Programming 1 May 15th 04 03:43 AM
Change minimumscale with the change event of a combobox Herbert Chan Excel Programming 1 April 11th 04 12:43 PM
change event/after update event?? scrabtree23[_2_] Excel Programming 1 October 20th 03 07:09 PM


All times are GMT +1. The time now is 07:47 PM.

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"