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!
 
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


See if this solution does what you want

Code:
Sub CHECK()
    Dim rng As Range
    Dim m As Variant
    
    With WorkSheets("SHIPPED")
        Set rng = .Range(.Range("C3"), .Range("C" & .Rows.Count).End(xlUp))
    End With
    
    m = Application.Match("CHECK", rng, 0)
    
    If Not IsError(m) Then
        rng.Cells(CLng(m), 1).Select
        MsgBox "ERROR IN PRICE" & Chr(10) & "Please check Shipping Instruction and/or Invoice.", _
        vbOKOnly + vbExclamation, "ERROR IN PRICE"
    Else
        MsgBox "CHECKING FINISHED", vbOKOnly + vbInformation, "Check Complete"
    End If


End Sub

Dave
 
Last edited:
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,215,334
Messages
6,124,321
Members
449,154
Latest member
pollardxlsm

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