Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default message box keeps popping

I would like to make the message box pop automatically when cell G24="pop".
But the message keeps popping when i click to anywhere in the worksheet.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Range("G24").Value = "pop" Then
Msg = MsgBox("Both Values do not agree", vbOKOnly)
End If
End Sub

Thanks for any help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default message box keeps popping

Hi Amelia,

Not certain that I really understand what you are trying to achieve.The code
you have will run every time you select a cell. It needs to be controlled so
therefore need to know what cell to be selected to fire the code. Also not
sure that Selection event is correct. Maybe should be Change event.

Do you want the code to run every time you select Cell G24?
or do you want it to run every time you change some other cell that caused
G24 to change to pop. If the latter, then what is the formula in G24? (That
tells me what other cell/s are being changed to return pop in G24.)

If none of the above then see if you can explain the problem a little more.
--
Regards,

OssieMac


"amelia" wrote:

I would like to make the message box pop automatically when cell G24="pop".
But the message keeps popping when i click to anywhere in the worksheet.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Range("G24").Value = "pop" Then
Msg = MsgBox("Both Values do not agree", vbOKOnly)
End If
End Sub

Thanks for any help!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default message box keeps popping

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Range("G24").Value = "pop" Then
Msg = MsgBox("Both Values do not agree", vbOKOnly)
Range("G24")=""
End If
End Sub


"amelia" wrote:

I would like to make the message box pop automatically when cell G24="pop".
But the message keeps popping when i click to anywhere in the worksheet.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Range("G24").Value = "pop" Then
Msg = MsgBox("Both Values do not agree", vbOKOnly)
End If
End Sub

Thanks for any help!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default message box keeps popping

You don't Mention how G24 Becomes the Word "pop"
If you are manually change the cell then try

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$24" Then
If Target = "pop" Then Msg = MsgBox("Both Values do not
agree", vbOKOnly)
End If
End Sub

If the cell changes by calculation then try this

Private Sub Worksheet_Calculate()
Dim r As Range
Set r = Range("G24")
If r = "pop" Then Msg = MsgBox("Both Values do not agree",
vbOKOnly)

End Sub
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default message box keeps popping

It works now, ive used curly dave's 2nd solution. My bad, should have
explained clearer. By the way, thanks for the help u all!

"CurlyDave" wrote:

You don't Mention how G24 Becomes the Word "pop"
If you are manually change the cell then try

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$24" Then
If Target = "pop" Then Msg = MsgBox("Both Values do not
agree", vbOKOnly)
End If
End Sub

If the cell changes by calculation then try this

Private Sub Worksheet_Calculate()
Dim r As Range
Set r = Range("G24")
If r = "pop" Then Msg = MsgBox("Both Values do not agree",
vbOKOnly)

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
Popping out Message Box! deepak Excel Discussion (Misc queries) 4 September 15th 09 03:53 PM
What's with this MS message that keeps popping up? Art Excel Programming 2 March 30th 07 02:52 PM
message box popping up when the selection of a Form combo box changes George Excel Programming 6 March 21st 07 10:31 PM
How to stop message popping up before open the excel? jenhu Excel Discussion (Misc queries) 2 August 3rd 06 02:02 PM
broken links message still popping up GJR3599 Excel Discussion (Misc queries) 1 March 30th 05 01:36 PM


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