#1   Report Post  
Meliisa
 
Posts: n/a
Default data validation

Hi
I have 2 cells that I would like to apply the same data validation list to.
However, the cells cannot equal each other. How do I apply the list and <
both to the cells?
Thansk for all replies
Melissa
  #2   Report Post  
Jason Morin
 
Posts: n/a
Default

Set up your validation list for both A1 and B1. Then
right-click on the worksheet tab, select "View Code", and
paste in the code below. Press ALT+Q to close:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Application
If Intersect(Target, [B1]) Is Nothing Then GoTo CheckA1
.EnableEvents = False
With Target
If .Value = .Offset(0, -1).Value Then
MsgBox "List selections cannot be the same!"
.Value = ""
End If
End With
.EnableEvents = True
Exit Sub
CheckA1:
If Intersect(Target, [A1]) Is Nothing Then Exit Sub
.EnableEvents = False
With Target
If .Value = .Offset(0, 1).Value Then
MsgBox "List selections cannot be the same!"
.Value = ""
End If
End With
.EnableEvents = True
End With
End Sub

---
HTH
Jason
Atlanta, GA

-----Original Message-----
Hi
I have 2 cells that I would like to apply the same data

validation list to.
However, the cells cannot equal each other. How do I

apply the list and <
both to the cells?
Thansk for all replies
Melissa
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Effect of Conditional Formatting, Data Validation Bill Sturdevant Excel Discussion (Misc queries) 1 January 25th 05 11:50 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
Data Validation Window? Ken Excel Discussion (Misc queries) 1 January 11th 05 10:48 PM
Excel2K: Is it possible to use dynamic named ranges in custom data validation formula? Arvi Laanemets Excel Discussion (Misc queries) 0 December 2nd 04 11:29 AM
data validation on sth else [email protected] Excel Worksheet Functions 1 November 3rd 04 01:52 PM


All times are GMT +1. The time now is 07:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"