+ Reply to Thread
Results 1 to 7 of 7

Disable Paste from Other sources

  1. #1
    Forum Contributor
    Join Date
    02-15-2012
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2019
    Posts
    431

    Disable Paste from Other sources

    Hi,

    Need VBA (or any other mechanism) to disable Paste from other sources for a selected range.

    An excel file attached with necessary details.

    Pl. help.

    Thanks,
    Nagesh.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,204

    Re: Disable Paste from Other sources

    Aa far as I can ascertain, you cannot determine the source of a copy/paste action.
    Last edited by JohnTopley; 03-22-2024 at 05:31 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Disable Paste from Other sources

    One solution might be to use a ChangeEvent to check the undo list for a Paste action and also check whether CutCopyMode is False.
    If CutCopyMode is False, then the operation is probably not internal.


    Please Login or Register  to view this content.
    Last edited by ByteMarks; 03-22-2024 at 05:25 AM.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,204

    Re: Disable Paste from Other sources

    @Bytemarks: copying from Sheet2 ("alien" sheet!) to Sheet1, the following worked (if I understand the code) i.e copied data was deleted from Sheet1

    Please Login or Register  to view this content.
    Last edited by JohnTopley; 03-22-2024 at 05:43 AM.

  5. #5
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Disable Paste from Other sources

    I assumed "other sources" were outside of Excel. If you copy within Excel then you have the marching ants and CutCopyMode is True (1), so the paste should be allowed.
    With CutCopyMode to 1 (True) in the code it'll undo if it is internal which is the opposite.
    Last edited by ByteMarks; 03-22-2024 at 05:49 AM.

  6. #6
    Forum Contributor
    Join Date
    02-15-2012
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2019
    Posts
    431

    Re: Disable Paste from Other sources

    @ByteMarks,
    I tried your code but is stopping from pasting data.

    @JohnTopley,
    Your code is Stopping from Pasting data entirely. But I require the pasting option in the existing Sheet (if not possible to restrict within Sheet, it is OK within the workbook).

    Pl. help.

  7. #7
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Disable Paste from Other sources

    Does this work for you?

    All the code is in ThisWorkbook

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by ByteMarks; 03-22-2024 at 08:48 AM.

+ 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. disable copy/cut/paste/paste special in excel 2010
    By Alina Loredana in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-22-2014, 06:43 PM
  2. Trap Catch Differentiate Disable Paste Button from Paste Special Options
    By m3atball in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-23-2013, 07:28 PM
  3. Disable Cut and Paste/Copy and Paste in Excel 2007
    By chessnsnuff in forum Excel General
    Replies: 2
    Last Post: 06-04-2013, 04:39 PM
  4. Replies: 1
    Last Post: 12-05-2012, 11:37 AM
  5. Replies: 0
    Last Post: 08-15-2012, 08:13 AM
  6. Enable/disable copy paste (disable part not working)
    By timtim89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-08-2012, 07:23 PM
  7. Using a macro to disable inputs from multiple sources
    By DianeElmes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-27-2010, 07:01 AM

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