+ Reply to Thread
Results 1 to 3 of 3

Data Validation code

  1. #1
    Forum Contributor
    Join Date
    08-14-2006
    Location
    USA
    MS-Off Ver
    2019
    Posts
    686

    Data Validation code

    I have (5) cells containing Data Validation:
    B2, B3, B5, B7 & B8 on Sheet 'ADD NEW'

    I have a Named Range (ValidationRange) refering to the non-contiguous range of cells containing Data Validation:
    ValidationRange =('ADD NEW!$B$2,'ADD NEW!$B$3,'ADD NEW!$B$5,'ADD NEW!$B$7,'ADD NEW!$B$8)

    Each Data Validation refers to a Dynamic Named Range
    Example B2 = OFFSET('Validation Lists'!$A$2,0,0,COUNTA('Validation Lists'!$A:$A),1)

    on the ADD NEW sheet I have this code from
    http://www.j-walk.com/ss/excel/tips/tip98.htm

    Please Login or Register  to view this content.
    Whether you attempt to type data into ANY cell (with Data Val or without), or select an allowed item from the Data Validation List, it always returns the Message.
    Clicking OK just brings the message back again and again.
    The only way out is to End the Excel Task from the Task Manager.

    What am I doing wrong?

    PS. I don't particularily care how I insure the Data Validation can't be removed, as long as it can't be.
    I've also tried some other ways using
    If Union(cell,ValRange).Address
    But can't figure that out either.

    Thanks

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    Could it be that the application.undo line is causing the problem?

    The HELP on this function says that it should only ever be used in the first line of a macro.

    A common problem with change event macros is that if they themselves cause any changes, another instance of the macro is called and, unless catered for, this can produce an infinite stack of calls resulting in a crash.

    It would be worth putting a breakpoint on the first line of the macro and executing lines one by one (F8) to see the flow of the code.

    Hope this helps.
    Martin

  3. #3
    Forum Contributor
    Join Date
    08-14-2006
    Location
    USA
    MS-Off Ver
    2019
    Posts
    686
    yes, I read that in the help file about the undo command, needing to be on the first line

    however, since I took it off the j-walk site I'm assuming the WIZARD (Mr. Walkenbach) would not have a flawed code on his site!

    It's much more highly probable that I have applied his code wrong!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1