+ Reply to Thread
Results 1 to 2 of 2

Data Validation - Ignored When Pasted

  1. #1
    Registered User
    Join Date
    08-22-2003
    Posts
    9

    Data Validation - Ignored When Pasted

    Good morning!

    I am having an issue where i have set a clumn's cells to have validation on them.

    The validation allows a whole numer between 8000000000 and 9000000000.

    The data is a TFN.

    But i use a VB app to read the excel files via drag and drop. If the cells aren't all numeric then it ignores the ones that aren't.

    So i put that validation in there to make sure people are entering them as 10 digit numbers without the ),(, or -.

    What I have noticed is if folks copy from another workbook and paste into the excel, with ),(, and - the cell accepts it with no problems : S

    Is there a way around the pasting?

    Thanks in advance!

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Data Validation - Ignored When Pasted

    You will have to use VBA to disable pasting, but the effectiveness of this is entirely dependent on the user choosing to enable macros when the workbook is opened.

    Here is one way to go about it and there is likely a better approach.
    Use this code in the workbook activate event. It is simply used to select any cell not among those that include validation. Adjust cell reference as needed.
    Please Login or Register  to view this content.
    Use this code in the worksheet module. The worksheet activate event uses the same approach as the workbook activate.

    The worksheet selectiion change event is used so that when the user selects any cell, the clipboard is cleared and there is nothing to copy. This code should be amended to target a specific range, but you didn't provide details on which cells are in view.
    Please Login or Register  to view this content.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

+ 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