+ Reply to Thread
Results 1 to 18 of 18

Preventing copy/paste into protected sheet

  1. #1
    Registered User
    Join Date
    01-26-2017
    Location
    Mississauga Ontario
    MS-Off Ver
    2010
    Posts
    5

    Preventing copy/paste into protected sheet

    I'm using Excel 2013 and have a protected worksheet that restricts number of characters, char-type, upper/lower etc. I'd like to know how to prevent people from doing copy & paste into the form because they are bypassing the verification restrictions by doing so and it allows more than the restricted 15 characters into the field.

    Brian

  2. #2
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Preventing copy/paste into protected sheet

    Could this work for you?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-26-2017
    Location
    Mississauga Ontario
    MS-Off Ver
    2010
    Posts
    5

    Re: Preventing copy/paste into protected sheet

    I have data verification in each CELL that prevents more than 15 characters when you type it in but when they copy/paste into the form, it allows more than 15. I'd like to stop them from doing a copy/past altogether if possible. If not then how would I apply your subroutine for more than one column of data (i.e. 40 cells).
    Attached Files Attached Files
    Last edited by bgane; 04-06-2017 at 10:11 AM.

  4. #4
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Preventing copy/paste into protected sheet

    Quote Originally Posted by bgane View Post
    I have data verification in each CELL that prevents more than 15 characters when you type it in but when they copy/paste into the form, it allows more than 15. I'd like to stop them from doing a copy/past altogether if possible. If not then how would I apply your subroutine for more than one column of data (i.e. 40 cells).
    When you refer to the form I am expecting you to have a userform. Is this correct or is this a worksheet with cells that you have made to look like a form?

    Could you attach a copy and I'll have a look?

  5. #5
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Preventing copy/paste into protected sheet

    Here, see attached workbook (sample I did for another forum sometime ago).
    Change target column/range as needed.

    Based on concept found in link below.

    https://www.mrexcel.com/forum/excel-...worksheet.html
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Preventing copy/paste into protected sheet

    If you are using Cell as the 'Form' then apply this code to that worksheet and change Range("A1") to whatever you 'form' range is

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-26-2017
    Location
    Mississauga Ontario
    MS-Off Ver
    2010
    Posts
    5

    Re: Preventing copy/paste into protected sheet

    This is a worksheet that looks like a form. There is currently no VB included, only data verification code for the unlocked cells that allow user input. I've attached the unprotected worksheet.

    Brian
    Attached Files Attached Files

  8. #8
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Preventing copy/paste into protected sheet

    Quote Originally Posted by CK76 View Post
    Here, see attached workbook (sample I did for another forum sometime ago).
    Change target column/range as needed.

    Based on concept found in link below.

    https://www.mrexcel.com/forum/excel-...worksheet.html
    it doesn't work
    I can copy cell into A column
    or use in any cell of A column something like: =D1

  9. #9
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Preventing copy/paste into protected sheet

    How does this work/look?

  10. #10
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Preventing copy/paste into protected sheet

    @Sandy666
    Hmm? I tested and worked fine on my end.

    Note that this code should be used in conjunction with Data Validation.

    So, =D1 will not be allowed if it's not allowed by Data Validation.
    Code just disables Cut/Copy and paste into range.

    0.JPG

  11. #11
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Preventing copy/paste into protected sheet

    Quote Originally Posted by CK76 View Post
    @Sandy666
    Hmm? I tested and worked fine on my end.

    Note that this code should be used in conjunction with Data Validation.

    So, =D1 will not be allowed if it's not allowed by Data Validation.
    Code just disables Cut/Copy and paste into range.

    Attachment 511261
    This file isn't using a list/dropdown

  12. #12
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Preventing copy/paste into protected sheet

    @PFDave
    I dodn't touch your vba code, but....

  13. #13
    Registered User
    Join Date
    01-26-2017
    Location
    Mississauga Ontario
    MS-Off Ver
    2010
    Posts
    5

    Re: Preventing copy/paste into protected sheet

    That works, thank you very much!!

    Appreciated.
    Brian

  14. #14
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Preventing copy/paste into protected sheet

    Weird, same for me :/

    Hows this?
    Attached Files Attached Files

  15. #15
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Preventing copy/paste into protected sheet

    Quote Originally Posted by bgane View Post
    That works, thank you very much!!

    Appreciated.
    Brian
    You're welcome Brian.

    If that takes care of this thread please mark as solved, and add any reputation that you see fit

  16. #16
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Preventing copy/paste into protected sheet

    @PFDave
    If you wish
    Attached Files Attached Files

  17. #17
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Preventing copy/paste into protected sheet

    Quote Originally Posted by sandy666 View Post
    @PFDave
    If you wish
    ????

    The first attached file didn't open, now this one opens and still works? You'd stumped me sandy

  18. #18
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Preventing copy/paste into protected sheet

    I attached your two files but I do not know what the server is doing that can not be opened
    In both, I can add what is forbidden, that is, small letters and text of length greater than 15

    btw. VBA is ON, I didn't open VB project, just paste values into your range (MAGIC )
    If you don't believe me, set pass for VBA

    Let me know if you find a solution
    Last edited by sandy666; 04-06-2017 at 11:04 AM. Reason: additional comment

+ 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. [SOLVED] Copy And Paste Into Protected Sheet
    By bgrish3 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-08-2016, 04:09 PM
  2. copy & paste protected sheet with protection
    By rana19 in forum Excel General
    Replies: 4
    Last Post: 10-06-2015, 08:44 AM
  3. How to allow users to copy and paste in protected sheet?
    By erkamu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2014, 06:35 AM
  4. Protected sheet gets unprotected when copy paste.
    By Jeyakumar in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 03-08-2013, 02:03 AM
  5. How to preventing running Macros on a protected sheet :)
    By 123wc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-23-2011, 03:25 PM
  6. Protected Sheet not protected from Copy Paste
    By twistedsymphony in forum Excel General
    Replies: 4
    Last Post: 04-19-2010, 05:37 PM
  7. How to copy/paste info into the protected sheet
    By Dajana in forum Excel General
    Replies: 1
    Last Post: 09-21-2005, 12:05 PM

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