Copy/paste without clipboard "Object required" ?

SnakZ

New Member
Joined
Feb 12, 2015
Messages
5
Windows 7 excel 2007
Im real new at VBA (but do know some PHP if that helps lol)

ANYWAY a website had a way to copy and past without using the clipboard link here: "Optimize Slow VBA Code. Speed Up Efficient VBA Code/Macros"
Code:
Sub Testing()
Sheet1.Range("A1").Copy Destination:=Sheet2.Range("B1")

End Sub

When i use this code i get an "Object required" and if i use "Option Explicit" i get "Variable not defined"

Only thing i can think of is i need to use a "Set" or "Dim" of some type at the top but that where im lost at lol

If i use it on the same sheet there no errors

Ty for any help one can give
 
Last edited:
Is the code located in the workbook that contains those two sheets?
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Is the code located in the workbook that contains those two sheets?


No all the code was saved on the "Personal.xlsb" workbook they was not saved inside the workbooks i was using it in.
You think thats what did it ?
 
Upvote 0
Yes - you can't use sheet codenames across workbooks unless you set a VB reference between the two projects.
 
Upvote 0

Forum statistics

Threads
1,214,946
Messages
6,122,401
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top