+ Reply to Thread
Results 1 to 4 of 4

Data Validation of Pasted Value

  1. #1
    Registered User
    Join Date
    05-18-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    5

    Data Validation of Pasted Value

    Hi,
    I have a problem when i pasted over a value from another worksheet to the worksheet which has data validation appplied on all the cells.

    For example, I want to copy the values from 'Sheet 3' to 'Sheet 1'.
    Sheet 1 has the data validation with the condition such that a text length which doesn't have 9 digits will prompt an error message ' Pls enter 9 digits'.

    There is a similar macro which i think can be used for this too. But im not too sure where i should edit to change to the condition that i want.


    Please Login or Register  to view this content.
    When i try using the data validation on sheet 1 and do a normal data entry it works fine. Just have a problem with copying and pasting part. Any help will be much appreciated. Thanks.
    Last edited by Bingo123; 05-20-2010 at 03:52 AM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Data Validation of Pasted Value

    Bingo,

    data validation works on manually entered values only. If you paste values via code, then you need to create code to check if the pasted value meets the criteria before pasting it.

  3. #3
    Registered User
    Join Date
    07-08-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Data Validation of Pasted Value

    Thanks teylyn for your reply.=) There are 2 ways that I can solve this. Either by formula or macro. But i really badly need help in the editing part.


    I have this formula that I can add to column C that returns a Y/N result if the text length of a value in column A is 9, it will return yes. if value is lesser or more than 9 than returns no.

    =IF(OR(LEFT(A1,2),LEFT(A1,2)),IF(LEN(B1)>9,"y","n"),"")


    I have this macro that reads every cell in the worksheet and deletes rows if the text length is lesser or more than 9. But when i run it it gives me a compile error. I think the problem is small but i can't put my finger as to where the problem lies. Help? Anyone?

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-08-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Data Validation of Pasted Value

    Bingo123, you can use the above codes but some editing should be done for both of the formulas and macro. That's the best that I can do to help. Cheers!

+ 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