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
Solved

Excel IF statement pop-up dialog box VBA

Posted on 2011-03-14
2
537 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

837 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