Results 1 to 10 of 10
  1. #1
    Lounger
    Join Date
    Nov 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy cut paste in Excel (Excel VBA)

    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

  2. #2
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy cut paste in Excel (Excel VBA)

    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

  3. #3
    Lounger
    Join Date
    Nov 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy cut paste in Excel (Excel VBA)

    Thanks ,
    Where should this sub go to?

  4. #4
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy cut paste in Excel (Excel VBA)

    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(<font color=red>1</font color=red>).Enabled = True

    change the <font color=red>1</font color=red> to a 2 and then 3 (pressing enter each time to run the line of code)

  5. #5
    Lounger
    Join Date
    Nov 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy cut paste in Excel (Excel VBA)

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

  6. #6
    Lounger
    Join Date
    Nov 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy cut paste in Excel (Excel VBA)

    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?

  7. #7
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy cut paste in Excel (Excel VBA)

    In the immediate window

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

    CommandBars(26).Controls(<font color=red>1</font color=red>).Enabled =true

  8. #8
    Lounger
    Join Date
    Nov 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy cut paste in Excel (Excel VBA)

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

  9. #9
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy cut paste in Excel (Excel VBA)

    True this macro - put it in a standard module in Excel. It will set all instances of Cut Cop and Paste to Enabled = "True"
    <pre>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


    </pre>


  10. #10
    Lounger
    Join Date
    Nov 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy cut paste in Excel (Excel VBA)

    Thanks barron,
    The code works.

Posting Permissions

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