+ Reply to Thread
Results 1 to 7 of 7

validation macro doesn't work

  1. #1
    Registered User
    Join Date
    01-17-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    11

    Question validation macro doesn't work

    i've written a macro that selects a range of cells (that part works) then sets data validation for those cells. it doesn't cause an error but it doesn't stop alphabetic characters being typed in the cells as its supposed to.

    heres my code:

    Please Login or Register  to view this content.
    what am i doing wrong?
    Last edited by .paul.; 01-26-2009 at 01:08 PM.

  2. #2
    Registered User
    Join Date
    05-02-2004
    MS-Off Ver
    2007
    Posts
    43

    Re: validation macro doesn't work

    Works for me.

    Are you sure that Selection is pointing at where you think it is?

    How does it not work?

    TJ

  3. #3
    Registered User
    Join Date
    01-17-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: validation macro doesn't work

    the selection is correct i think.

    it runs ok, but it doesn't stop invalid entries. its supposed to accept only integers but it accepts anything...

  4. #4
    Registered User
    Join Date
    05-02-2004
    MS-Off Ver
    2007
    Posts
    43

    Re: validation macro doesn't work

    How are you entering the data into the cell?

    I just recorded a macro in 2007 and the code is the same as yours.

    Is there much more to your code, if not could we see the rest?

    TJ

  5. #5
    Registered User
    Join Date
    01-17-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: validation macro doesn't work

    i'm trying to set validation in the macro. the inputting is manually in the worksheet.

  6. #6
    Registered User
    Join Date
    05-02-2004
    MS-Off Ver
    2007
    Posts
    43

    Re: validation macro doesn't work

    Not much else I can suggest, the code should work. Double check that you are not doing anything to the cell in the macro (copying another cell contents to it, etc) and that Selection is where you think it is.

    Just a long shot as well, Validation will only report an error when you hit the return key.

    TJ

  7. #7
    Registered User
    Join Date
    01-17-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: validation macro doesn't work

    my mistake. your last guess was right. i could've sworn it was stopping me typing invalid characters before, but as you said it validates when you move away from the cell.

    thanks for your help...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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