• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Pop up window & condition

Buddha_420

New Member
Hi all,

The below code makes a window pop up if the condition is met (T1 <>0). It works fine but my problem is that when I close the window, it pops up again soon after as the condition is still met until I can fix it. Is there a way to have the window stop popping up for say 5 minutes?

Thanks,
William



Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Sheets("Overview").Range("T1") <> 0 Then
MsgBox "Mismatch!"
End If

End Sub
 
chihiro's suggestion is far better!

Yo may try this..

Code:
Dim x As Double
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Sheets("Overview").Range("T1") <> 0 And _
    (x + TimeValue("00:05:00")) < Now Then MsgBox "Mismatch!": x = Now
End Sub
 
Why not put it into Worksheet_Change event, so that it only fires when value is changed in a cell.

Or alternately, just put it in Modules section and fire it with F5?
chihiro's suggestion is far better!

Yo may try this..

Code:
Dim x As Double
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Sheets("Overview").Range("T1") <> 0 And _
    (x + TimeValue("00:05:00")) < Now Then MsgBox "Mismatch!": x = Now
End Sub


Thanks Chihiro/Deepak,

Both solutions work fine. I've chosen Deepak's one though, as it may involve several operations to correct the mismatch.
 
Back
Top