?
Solved

Excel IF statement pop-up dialog box VBA

Posted on 2011-03-14
2
Medium Priority
?
550 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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 how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

777 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