PDA

View Full Version : [SOLVED:] Button to copy cells from A4 to A13 to the clipboard



MasterBash
06-09-2024, 09:56 AM
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 ?

Logit
06-09-2024, 12:03 PM
No errors occur here. Button 1 is connected to Macro "Button 1" and Button 2 is connected to Macro "Button 2".

MasterBash
06-09-2024, 12:26 PM
Thanks.

I figured it out.

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

Aussiebear
06-09-2024, 01:50 PM
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