Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Excel IF statement pop-up dialog box VBA

Posted on 2011-03-14
2
Medium Priority
?
555 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 24

Accepted Solution

by:
StephenJR earned 2000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

609 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