coveredinbutter
New Member
- Joined
- Dec 20, 2021
- Messages
- 19
- Office Version
- 365
- Platform
- Windows
Hi All,
I have a working macro that will add a new sheet and paste the contents of the clipboard to cell a1 of that sheet using the following code:
Application.ScreenUpdating = False
Application.EnableEvents = False
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "TempSheet"
Worksheets("tempsheet").Range("A1").PasteSpecial xlPasteValues
I'm trying to add this to something I'm writing for another work book but when I try and run the same code I get:
Run-time error '1004':
PasteSpecial method of Range class failed.
Any ideas on why it is failing in the second workbook?
Thanks for your help.
I have a working macro that will add a new sheet and paste the contents of the clipboard to cell a1 of that sheet using the following code:
Application.ScreenUpdating = False
Application.EnableEvents = False
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "TempSheet"
Worksheets("tempsheet").Range("A1").PasteSpecial xlPasteValues
I'm trying to add this to something I'm writing for another work book but when I try and run the same code I get:
Run-time error '1004':
PasteSpecial method of Range class failed.
Any ideas on why it is failing in the second workbook?
Thanks for your help.