How To Check Cell Value In VBA And Display Message Box

This post is to help answer a question from the youtube video at

hi, i need help with the msgbox. I would like a msgbox to pop up if a particular value is smaller than a condition value eg. is 39 < 40, a msgbox should pop up to indicate that the number is smaller. How can I go about doing this?

For starters make sure your workbook is a “.xlsm”

Here is the data:

We are going to loop through the cells in A2 to A14, and check if they are less than the value in D2, and if the value is less, we will display a message box.

Here is the code:

Now when the button “Button 1” is clicked and cells will be evaluated and display a message box if the condition is met.

Let me know if you have any questions.


Please remember to subscribe to my youtube channel

Been helped? Get these!