Msgbox with certain value

JEANNYNEWBIE

New Member
Joined
Jan 15, 2019
Messages
10
Hi, I am currently studying the VBA and trying out this on my file but i got runtime error..

In my worksheet "SHIPPED", range "C3:C600"
I would like to have a message pop up when the cell contains "CHECK"
Other text found this column varies so I wanted t have a msg alert when there is "CHECK" in this range.


Private Sub Check_Price()

If Range("C3:C6000").Value = "CHECK" Then
MsgBox "Error in Price", chr10, "Please check Shipping Instruction"
End If

End Sub

Please help.. thanks you so much!
 
I did research on Msgbox contents and i modified it. The user chose this.
Really? and it runs with your alteration back to the syntax that erred?

I wanted to add another msgbox for information when user click the button CHECK

If you put it in an else statement you will get a message box appear for every cell that doesn't have the word CHECK in it.

Does the code I posted not work? If not what does it not do?
 
Last edited:
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I looks like this, and it works just fine!

D4s6wRQRMVJjAAAAAElFTkSuQmCC



It is for every cell?! that's why seems unending when i tried .

The code you gave was, without a doubt OK.. Thanks so much.

I just wanted to add another message box to prompt the user that [CHECKING FINISHED].
:)
 
Upvote 0
Just add a new line on code at the end of your script like this:

Msgbox "We are done"
 
Upvote 0
thank you! that was easy! :)

But when there is no value [CHECK] in range, msgbox "We are done" does not appear :(

If you put this line of code as the last line in the script it must work.

If you cannot get this to work show me the script your using.
 
Upvote 0
Here:

Sub CHECK()

Dim myCel As Range
For Each myCell In Sheets("SHIPPED").Range("C3:C6000")
If myCell.Value = "CHECK" Then
MsgBox "Please check Shipping Instruction and/or Invoice", Chr10, "ERROR IN PRICE", vbOKOnly, vbExclamation


Exit Sub
MsgBox "CHECKING FINISHED", vbOKOnly + vbInformation
End If


Next

End Sub
 
Upvote 0
Well I have been watching this posting but I have been confused from the beginning what your trying to do. So I have just watched Mark Help you.

So lets just wait and let Mark finish helping you.
 
Last edited:
Upvote 0
Well I have been watching this posting but I have been confused from the beginning what your trying to do. So I have just watched Mark Help you.

So lets just wait and let Mark finish helping you.

I won't be posting anything because I too am confused as the code in post number nine only gives the 2nd message box if there is no CANCEL in the range so really don't know the issue :confused::confused::confused:
 
Upvote 0
Especially confused as the bit in red will error as expected for me

Dim myCell As Range
For Each myCell In Sheets("SHIPPED").Range("C3:C6000")
If myCell.Value = "CHECK" Then
MsgBox "Please check Shipping Instruction and/or Invoice", chr10, "ERROR IN PRICE", vbOKOnly + vbExclamation
Exit Sub
'Else
'MsgBox "CHECKING FINISHED", vbOKOnly + vbInformation
End If
Next

End Sub

and yet the OP states...

I looks like this, and it works just fine!
In response to
Really? and it runs with your alteration back to the syntax that erred?
:confused::confused::confused:
 
Upvote 0

Forum statistics

Threads
1,215,328
Messages
6,124,295
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top