I made the following code. Basically if a cell value is 300000 then a message box appears saying "You have selected grants of £30000". Same thing for 500000. The issue I am having is, after the pop up message is appearing, I have to click on "ok" 2 times before it closes. I only want to press on ok once for it to close. How to fix this?
Option Explicit
Private Sub Worksheet_Calculate()
Dim Rng1 As Range
Dim Value As Double
Dim Prompt As String
Dim Title As String
'Put the range you want to look at here
Set Rng1 = Range("B7")
'Put the target value here
Value = 500000
'Put the message (prompt) of the message box (pop up) here
Prompt = "You have selected a grant of £500000"
'Put the title of the message box (pop up) here
Title = "Title"
If Rng1.Value = Value Then
MsgBox Prompt, vbInformation, Title
End If
'Put the range you want to look at here
Set Rng1 = Range("B7")
'Put the target value here
Value = 300000
'Put the message (prompt) of the message box (pop up) here
Prompt = "You have selected a grant of £300000"
'Put the title of the message box (pop up) here
Title = "Title"
If Rng1.Value = Value Then
MsgBox Prompt, vbInformation, Title
End If
End Sub
Bookmarks