Consulting

Results 1 to 14 of 14

Thread: Paste disable button - in sheet

  1. #1

    Paste disable button - in sheet

    Hi all

    I have this VBA macro, workbook link enclosed, name MacrosTestingPasteBlock.xlsm.

    The macros works fine for me, but when try to paste once enter the password "test" to enter data the paste button do not work, its disable.

    Need to use the Clipboard to manually paste.

    Is my belief that somehow the macros disable the paste option.

    Been unable to load xlsm file (see image attached), enclosed link to download from mega.nz


    https://mega.nz/file/3IBgFCrD#UAE_m8...RCm7ABd1YQS8AY



    Any suggestions how this issue can be solved.

    Thanks for the help!!!!!!!
    Attached Images Attached Images
    Last edited by vitorio; 11-24-2024 at 08:24 AM.

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,409
    Location
    I believe that your file is over the maximum size. Is there any way to minimise the file size?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    Size is 4,191kb.

    Been unable to load xlsm file (see image attached), enclosed link to download from mega.nz


    https://mega.nz/file/3IBgFCrD#UAE_m8...RCm7ABd1YQS8AY

    This size still can not load.

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,409
    Location
    You have 25 modules within your workbook. Is your workbook or worksheet protected when you try to carry out the operation?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    Yes. The worksheet is protected but the cells where enter data are unlocked.

    If used the Excel Clipboard manually I can paste data after copy.

  6. #6
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,409
    Location
    So I would suggest you have a good look at any macro that has as its intention pasteing data into the sheet.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  7. #7
    Any suggestions, more specifically, where to look, please.
    I have been looking various days for information about this issue without any luck.

    Any information, specially, those experience VBA coders is welcome

    Thanks Aussiebear for your interest and ideas to try to solve this issue

  8. #8
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,409
    Location
    If you run this macro, does it allow you to paste data?

    Sub AllowPasteToProtectedSheet()
        Dim TargetRange As Range
        ' Specify the target range where you want to allow pasting
        Set TargetRange = Range("A1:D10") 
        ' Adjust the range as needed
        ' Unprotect the sheet (you may need to set a password)
        ActiveSheet.Unprotect Password:="your_password"
        ' Paste the data into the target range
        TargetRange.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
        ' Protect the sheet again
        ActiveSheet.Protect Password:="your_password", UserInterfaceOnly:=True, AllowFormattingCells:=True, AllowFormattingRows:=True, _
        AllowFormattingColumns:=True, AllowInsertingRows:=True, AllowInsertingColumns:=True, AllowDeletingRows:=True, _
        AllowDeletingColumns:=True, AllowSorting:=True, AllowFiltering:=True, AllowPivotTables:=True
    End Sub
    I've not tested this, however it I believe that it should. Note after UserInterfaceOnly:= True, the rest are optional ones which may be deleted.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  9. #9
    Just return from Xmas vacation.

    I removed the sheet protection and still can not copy and paste only if use the Clipboard to manually paste.

    If the cells are protected Excel provide this message:

    "The cell you are trying to change is on a protect sheet. To make a change unprotect the sheet"

    Please provide any other possible situations the prevent the copy and paste so I can look deeper in them.

    Thanks all for their input specially to
    Aussiebear for their time in help me.


    PS The Excel macro link with this issue is above. Can be downloaded from MEGA link. Password "test"




  10. #10
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,409
    Location
    Did you change "Your password" twice in the code provided?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  11. #11
    No I did not.

    There is an initial password, "test".

    In the real file depending of the password enter it opens a page for the sheet that is under he/she responsibility.

    Why you ask? Maybe this way I can understand the purpose of the question and answer it more detail.

    Thanks.

  12. #12
    Found this a few minutes ago from a Microsoft note site post:

    " Using the Worksheet_SelectionChange event will clear the clipboard, which disables the Paste Special option. To enable the option, you need to set the value of the Application.EnableEvents property to False."


    If this is possible?, this way I lost the Worksheet SelectionChange event (turn off (false)) which I needed.

    Any way to bypass this possibility?
    Last edited by vitorio; 01-12-2025 at 01:50 PM.

  13. #13
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,409
    Location
    In the code I provided have a look at lines 7 & 11. When you change both instances of "your password" then you give the code a chance to work.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  14. #14
    I still do not get it. If I unprotect the sheet, no password assigned. I still can not copy and paste. Only paste manually using the Excel clipboard.

    My thinking still is that there is not a relation with passwords. That is why I not see the purpose of the code provided.

    More where there is a comment from Microsoft as mention above and below

    " Using the Worksheet_SelectionChange event will clear the clipboard, which disables the Paste Special option. To enable the option, you need to set the value of the Application.EnableEvents property to False."

    Something is disable the paste option, in my opinion.

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •