-----------------------------------------------------------------------------

Hi xmux,


Dave is absolutely right. and here is how you can achieve this.

1. Press Alt+F11.
2. Double Click on the Sheet in Left pane, where you've placed Data
Validation.
3. Then Paste the following code in Code window.

Private Sub Worksheet_Change(ByVal Target As Range)
    'Assuming that you've applied Data Validation in Range("A1:A15").
    If Target.Column = 1 And Target.Row < 15 Then

        'Assuming Data Validation list is "ABC,DEF,MNO,XYZ,
123,456,RST"
        If Target.Value = "ABC" Or _
            Target.Value = "DEF" Or _
            Target.Value = "MNO" Or _
            Target.Value = "XYZ" Or _
            Target.Value = "123" Or _
            Target.Value = "456" Or _
            Target.Value = "RST" Then
        Else
            Application.Undo
        End If
    End If
End Sub


------------------------------------------------------------------------



For more tips, tricks, downloads and problem solutions: visit -->
http://www.excelitems.com
------------------------------------------------------------------------
Regards
*Ashish **Jain*
Analyst, CSC Australia
Microsoft Certified Application (Excel) Specialist
Technical Trainer - Excel and VBA
Author -> www.excelitems.com
+91-9999-40-48-43
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------

On Mar 19, 8:48 am, Dave Bonallack <davebonall...@hotmail.com> wrote:
> Hi xmux,
>
> This is the main weakness of data validation. The only way around it is to 
> check the entry using a VBA Change event code.
>
> Regards - Dave.
>
> _________________________________________________________________
> View photos of singles in your area. Click 
> Herehttp://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fdating%2Eninemsn%2Eco...
--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to