Consulting

Results 1 to 4 of 4

Thread: Button to copy cells from A4 to A13 to the clipboard

  1. #1

    Button to copy cells from A4 to A13 to the clipboard

    Hello,

    I have... let's say sheet3, that has 5 shapes that are used as buttons.
    I am trying to assign a macro to copy cells to the clipboard.

    Sub button1()
        Range(“A4,A13”).Select
        Selection.Copy
    End Sub
    
    Sub button2()
        Range(“B4,B13”).Select
        Selection.Copy
    End Sub
    etc... for all 5.

    I put those inside the sheet3, but when I click on them, I get an error 400.

    Why is that ?

  2. #2
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    612
    Location
    No errors occur here. Button 1 is connected to Macro "Button 1" and Button 2 is connected to Macro "Button 2".

  3. #3
    Thanks.

    I figured it out.

    " and “ are different and I did not see that at first.

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,180
    Location
    You might also rewrite your code.


    Sub button1()
        Range(“A4:A13”).Copy
        'Do something with the copy
    End Sub
    
    Sub button2()
        Range(“B4:B13”).Copy
        'Do something with the copy
    End Sub
    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

Tags for this Thread

Posting Permissions

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