Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default Trigger Event Code

I have a formula in cell B1 that is linked to several other cells. If
various condidtions are met, the value in cell B1 will equal, "Yes".
Otherwise, it equals, "No".

Is there a way I can trigger a macro anytime the value in Cell B1 changes
from "No" to "Yes". I would like for a message box to pop-up with a warning.



--
Thanks
Shawn
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Trigger Event Code

Hi Shawn,

Try:
Private Sub Worksheet_Calculate()
Dim rng As Range
Static blFlag As Boolean
Set rng = Range("B1")

If rng.Value = "Yes" Then
If Not blFlag Then
MsgBox "No has changed to Yes", _
vbInformation, "ALERT!"
blFlag = True
End If
Else
blFlag = False
End If

End Sub


This is worksheet event code and needs to be placed in the sheet module
behind the worksheet in question, *not* in a standard module.

So, access the sheet module by right-clicking the sheet tab, select 'View
Code', paste the above code, Alt-F11 to return to the worksheet.


---
Regards,
Norman



"Shawn" wrote in message
...
I have a formula in cell B1 that is linked to several other cells. If
various condidtions are met, the value in cell B1 will equal, "Yes".
Otherwise, it equals, "No".

Is there a way I can trigger a macro anytime the value in Cell B1 changes
from "No" to "Yes". I would like for a message box to pop-up with a
warning.



--
Thanks
Shawn



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Trigger Event Code


Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Address = "$B$1" Then
Application.EnableEvents = False
If Target.Value = yes Then
Msgbox ("B1 = Yes")
Application.EnableEvents = True
End I

--
Loss
-----------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...fo&userid=2481
View this thread: http://www.excelforum.com/showthread.php?threadid=38713

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 to trigger drop down-select event Excel User Excel Programming 1 February 10th 05 07:22 PM
trigger an EVENT when the value in a cell changes? Controls Freak Excel Programming 1 December 21st 04 07:24 AM
Trigger Event - Frank Stone Todd Huttenstine Excel Programming 0 July 14th 04 09:04 PM
Trigger Event Todd Huttenstine Excel Programming 2 July 14th 04 06:50 PM


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