+ Reply to Thread
Results 1 to 3 of 3

Paste restriction code in vba not affecting GUI copy/paste only Ctrl+V

  1. #1
    Registered User
    Join Date
    05-21-2015
    Location
    Austin, TX
    MS-Off Ver
    2013
    Posts
    20

    Paste restriction code in vba not affecting GUI copy/paste only Ctrl+V

    I have been working on the code in this workbook all day, and have everything else finally working except for this last piece.

    My goal is that if someone tries to paste into the workbook, they will only get the option to paste 'values' in order to protect the Data Validations. I can get it to work if I Ctrl+C in another workbook, but not if I use the GUI context menu to choose Copy | Paste from another workbook.

    Also open to other suggestions for improvement, but didn't want to bog this post down with an explanation of everything else the code is doing other than the one problem I have remaining.

    paste_data validation controls template.xlsm

    Here is the code for the paste restrictions:

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Paste restriction code in vba not affecting GUI copy/paste only Ctrl+V

    Why not try something like this?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-21-2015
    Location
    Austin, TX
    MS-Off Ver
    2013
    Posts
    20

    Re: Paste restriction code in vba not affecting GUI copy/paste only Ctrl+V

    Thanks for the reply spitfireblue - I had seen and tried that code from another site but never could get it to work; I think while the code might have worked fine by itself, it didn't want to play nice with the other code I needed in the workbook.

    I've managed to get this working successfully using the code in this workbook (also pasted below); There is code in each sheet, plus code in the workbook, as well as a macro saved with a shortcut key of Ctrl + v to override the Ctrl+v function with 'paste values only'.

    This workbook does the following:
    1) Ensure the end user enables macros, because they cannot see any of the sheets except the warning sheet telling them to enable macros if they don't
    2) Replaces both the context menu and Ctrl+v paste commands with "paste special values only" to ensure that the Data Validation on certain cells is not overwritten.
    3) once the data is pasted, it looks at every cell with validation and compares the data entered with data validation choices; any that don't match initiate a pop-up asking the user to correct the data.
    enable_macros-paste_values_only-post_paste_validation.xlsm
    Credits to mikeerickson from post: http://www.excelforum.com/excel-prog...ion-cells.html

    Please Login or Register  to view this content.
    AND
    Ken C Johnson (from another site) for sharing their code that I was able to reuse here.
    Please Login or Register  to view this content.
    Last edited by DT211569x; 01-28-2016 at 10:09 AM. Reason: give credit

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy/Paste restriction removed when pasting from one wb to another
    By iecbso in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-07-2015, 01:13 PM
  2. [SOLVED] Using CTRL+F and CTRL+G with Copy/Paste
    By waves678 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-13-2015, 10:30 AM
  3. Disable cut,copy,paste(including ctrl x, ctrl c n ctrl v)
    By Ramboexcel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2014, 01:00 AM
  4. [SOLVED] Problem using ctrl+Z on copy-paste-value macro
    By amphinomos in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-24-2014, 09:12 AM
  5. [SOLVED] Modify my Code i can't delete, copy-paste multiple cells also unable to do CTRL + D
    By vengatvj in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2013, 01:58 PM
  6. Replies: 0
    Last Post: 10-29-2013, 09:38 AM
  7. Macro code help with ctrl and find/ copy and paste in excel
    By leanne2011 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-24-2011, 10:35 AM

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