• Copy cut paste in Excel (Excel VBA)

    Author
    Topic
    #449742

    Hi,
    I was practicing with excel vba, and i try the disable cut , copy, paste.
    I did not like that macro so i deleted it, but every time i open up my excel the cut copy paste on my mouse right click does not work.
    When i right click, the option to cut copy paste is grey out, but i can use ctrl+c to copy
    any idea how to fix this?
    I try opening my excel in safe mode and the right click copy paste cut work just fine.
    Please advise

    Viewing 1 reply thread
    Author
    Replies
    • #1103536

      Quickie to turn the right click Cut, Copy and Paste back on.

      Sub CCP_OnOff()
      Dim i As Integer
      For i = 1 To 3
      CommandBars(“Cell”).Controls(i).Enabled = True
      Next
      End Sub

    • #1103538

      You can run it from any module within Excel.

      You can also turn them back on, one at a time, by using the immediate window (Ctrl+G while in Excel’s VBA)

      Paste the following into the immediate window and press enter

      CommandBars(“Cell”).Controls(1).Enabled = True

      change the 1 to a 2 and then 3 (pressing enter each time to run the line of code)

      • #1103540

        Thanks mbarron,
        It work prefectly.
        I was so nervous this morning . I thought i wreck my excel.
        Thanks alot

      • #1103544

        Hi
        I could copy using right click, but i cant do it in excel page preview.
        I cant right click and select cut copy or paste.
        any suggestion?

        • #1103548

          In the immediate window

          As before, change the 1 to 2 and then 3.

          CommandBars(26).Controls(1).Enabled =true

          • #1103600

            Starnge thing.. it did not work
            any more suggestions?
            thanks

            • #1103603

              True this macro – put it in a standard module in Excel. It will set all instances of Cut Cop and Paste to Enabled = “True”

              Sub enable()
              Dim i As Integer, j As Integer, rRow As Integer, cCol As Integer
              For i = 1 To CommandBars.Count - 1
                  For j = 1 To CommandBars(i).Controls.Count
                      If CommandBars(i).Controls(j).Caption = "Cu&t" _
                      Or CommandBars(i).Controls(j).Caption = "&Copy" _
                      Or CommandBars(i).Controls(j).Caption = "&Paste" Then
              
                      If CommandBars(i).Controls(j).Enabled = False Then
                         CommandBars(i).Controls(j).Enabled = True
                      End If
                      End If
                  Next
              Next
              
              End Sub
              
              
              
            • #1103621

              Thanks barron,
              The code works.

    Viewing 1 reply thread
    Reply To: Reply #1103548 in Copy cut paste in Excel (Excel VBA)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel