Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Event Procedures: Event on Worksheet to fire Event on another Worksheet

The following code works fine if I change the value of the
target (D26) directly in the worksheet. However, I want
this event to be triggered by a user entering a date in
another worksheet (the target worksheet will not have
focus). Target is difference between TODAY() and date
entered by user so it will change when the user enters
date.

Douglas was asking about this on March 7 & 8 but I can't
find the solution. Any suggestions?

Thanks so much! You are all so helpful!
Kathryn

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("D26")) Is Nothing Then Exit
Sub
On Error GoTo CleanUp:
With Target
If .Value Then
Application.EnableEvents = False
Dim Msg, Style, Title, Help, Ctxt, Response,
MyString
Msg = "Do you want to continue ?" ' Define
message.
Style = vbYesNo + vbCritical +
vbDefaultButton2 ' Define buttons.
Title = "MsgBox Demonstration" ' Define
title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000
Response = MsgBox(Msg, Style, Title, Help,
Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes" ' Perform some action.
Else ' User chose No.
MyString = "No" ' Perform some action.
End If
End If
End With

CleanUp:
Application.EnableEvents = True
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Event Procedures: Event on Worksheet to fire Event on another Worksheet

Hi
you may have a look at the worksheet_calculate event and use this event
instead of your current worksheet_change event

--
Regards
Frank Kabel
Frankfurt, Germany

"Kathryn" schrieb im Newsbeitrag
...
The following code works fine if I change the value of the
target (D26) directly in the worksheet. However, I want
this event to be triggered by a user entering a date in
another worksheet (the target worksheet will not have
focus). Target is difference between TODAY() and date
entered by user so it will change when the user enters
date.

Douglas was asking about this on March 7 & 8 but I can't
find the solution. Any suggestions?

Thanks so much! You are all so helpful!
Kathryn

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("D26")) Is Nothing Then Exit
Sub
On Error GoTo CleanUp:
With Target
If .Value Then
Application.EnableEvents = False
Dim Msg, Style, Title, Help, Ctxt, Response,
MyString
Msg = "Do you want to continue ?" ' Define
message.
Style = vbYesNo + vbCritical +
vbDefaultButton2 ' Define buttons.
Title = "MsgBox Demonstration" ' Define
title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000
Response = MsgBox(Msg, Style, Title, Help,
Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes" ' Perform some action.
Else ' User chose No.
MyString = "No" ' Perform some action.
End If
End If
End With

CleanUp:
Application.EnableEvents = True
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Event Procedures: Event on Worksheet to fire Event on another Worksheet

Thank you!


-----Original Message-----
Hi
you may have a look at the worksheet_calculate event and

use this event
instead of your current worksheet_change event

--
Regards
Frank Kabel
Frankfurt, Germany

"Kathryn" schrieb

im Newsbeitrag
...
The following code works fine if I change the value of

the
target (D26) directly in the worksheet. However, I want
this event to be triggered by a user entering a date in
another worksheet (the target worksheet will not have
focus). Target is difference between TODAY() and date
entered by user so it will change when the user enters
date.

Douglas was asking about this on March 7 & 8 but I can't
find the solution. Any suggestions?

Thanks so much! You are all so helpful!
Kathryn

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("D26")) Is Nothing Then

Exit
Sub
On Error GoTo CleanUp:
With Target
If .Value Then
Application.EnableEvents = False
Dim Msg, Style, Title, Help, Ctxt, Response,
MyString
Msg = "Do you want to continue ?" '

Define
message.
Style = vbYesNo + vbCritical +
vbDefaultButton2 ' Define buttons.
Title = "MsgBox Demonstration" ' Define
title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000
Response = MsgBox(Msg, Style, Title, Help,
Ctxt)
If Response = vbYes Then ' User chose

Yes.
MyString = "Yes" ' Perform some

action.
Else ' User chose No.
MyString = "No" ' Perform some action.
End If
End If
End With

CleanUp:
Application.EnableEvents = True
End Sub


.

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
Event doesn't fire Frank Xia Excel Discussion (Misc queries) 6 February 11th 06 12:54 AM
Event to fire when pivottable is pivoted Tod Excel Programming 1 April 5th 04 09:09 PM
Worksheet_Change event won't fire to execute Macro??? jpdill5 Excel Programming 2 February 13th 04 02:34 PM
Creating Event procedures from a macro Robert Stober Excel Programming 3 September 7th 03 06:52 PM
How do I get Pivot filter change event to fire? Claude Excel Programming 4 August 15th 03 10:24 PM


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