+ Reply to Thread
Results 1 to 5 of 5

VBA for data validation on copy / paste

  1. #1
    Registered User
    Join Date
    02-03-2010
    Location
    Seol, Korea
    MS-Off Ver
    Excel 2003
    Posts
    12

    VBA for data validation on copy / paste

    hi friends

    with the help of one of the members here, i've been able to implement data validation on multiple cells (http://www.excelforum.com/excel-prog...ple-cells.html)

    i want to preserve this validation even when the user copies & pastes the content from another excel. currently the validation works during the data entry mode only.

    im told it is a limitation of excel (copy/pastes over rides any validation on the cell), though it can be achieved via VBA.

    if anyone has come across any code which accomplishes this, please let me know. i've been after this for a while now.

    thanks.

  2. #2
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: VBA for data validation on copy / paste

    You will have to write the code in Worksheet_Change module which would check for data entered in any way (typed or copy-pasted) & if the data doesn't comply with the mentioned conditions, it wouldn't accept & you can choose to give a Validation error through a message box.

    If you are not good with coding, attach the file & mention the conditions & I would write it for you.

    Regards,
    Karan

  3. #3
    Registered User
    Join Date
    02-03-2010
    Location
    Seol, Korea
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: VBA for data validation on copy / paste

    hi karan. thanks for looking at it. i've attached the excel sheet here. i've done very little coding in VBA before. but this is way out of my reach. regards.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    04-18-2009
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2016
    Posts
    269

    Re: VBA for data validation on copy / paste

    Use this code in the Sheet Module:

    Please Login or Register  to view this content.

    Refer the attached file. Don't forget to enable macros.

    Regards,
    Karan
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-03-2010
    Location
    Seol, Korea
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: VBA for data validation on copy / paste

    thanks a million karan
    that looked so easy to do, after you coded it.
    really appreciate it.
    good luck.

+ 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