Solved

Excel IF statement pop-up dialog box VBA

Posted on 2011-03-14
2
535 Views
Last Modified: 2012-05-11
Hello,

I have a spreadsheet where a user enters numbers into column G.  

I would like to use a VBA script that will make a dialogue box pop-up if a number entered into a cell in column G is less than the number directly above it.

Any help is greatly appreciated.
0
Comment
Question by:evanmarshall
2 Comments
 
LVL 24

Accepted Solution

by:
StephenJR earned 500 total points
ID: 35131884
Try this in the sheet module - right-click the sheet tab, View Code and paste this in:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column <> 7 Then Exit Sub

If IsNumeric(Target.Value) And IsNumeric(Target.Offset(-1).Value) And Target.Value < Target.Offset(-1).Value Then
    MsgBox "Less than"
End If

End Sub

Open in new window

0
 

Author Closing Comment

by:evanmarshall
ID: 35132659
Excellent.  Thank you!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now