ExcelTip.com
Account Icon Account Icon Account Icon
ExcelTip.com

Go Back   Excel Help Forum > Microsoft Office Application Help - Excel Help forum > Excel 2007 Help

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-11-2008, 03:32 PM
superman_86 superman_86 is offline
Registered User
 
Join Date: 10 Jan 2008
Posts: 9
superman_86 is an unknown quantity at this point
Custom Data Validation

I have a question which seems relatively simple around Data Validation.

Column A contains a free text field for a date. Column B, contains a list Data Validation of status. The status drop down options are "Complete","In Process","Cancelled".

The goal is whenever someone selects "Complete" from the status column if there is not a date in column A to have an error message pop up. Can someone please assist? Thank you! (Note this is in Excel 2007)

A B
Date Status
Reply With Quote
  #2  
Old 11-11-2008, 04:47 PM
pjoaquin's Avatar
pjoaquin pjoaquin is offline
Forum Moderator
 
Join Date: 05 Feb 2007
Location: Wisconsin, U.S.A.
Posts: 2,331
pjoaquin is a jewel in the rough
Hi Superman,

I don't believe you could do both with Data Validation (create the drop-down list AND check to see if a date is in column A of that row). For that you could use a worksheet_change even macro like the one below:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column <> 2 Or Target.Value <> "Complete" Then Exit Sub
    If Not (IsDate(Cells(Target.Row, 1).Value)) Then
        MsgBox "You must first enter a date in column A before " & _
            "changing the status!", vbExclamation, "Warning!"
        Application.EnableEvents = False
        Application.Undo
        Application.EnableEvents = True
    End If
End Sub
Any time you change a value in column B to Complete it will check to see if a valid date exists in column A for that row. If not, the user will get a warning message and the last change will be undone. If yes, the user won't see any message (it will allow them to change the status).

Hope that helps!
__________________
- Paul

Click here to read the Forum Rules

Reply With Quote
Reply

Bookmarks

New topics in Excel 2007 Help


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -4. The time now is 11:36 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0