View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
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!