New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

run time error 1004 paste method worksheet class faailed

Macros, VBA, Excel Automation, etc.

run time error 1004 paste method worksheet class faailed

Postby segar » Wed Mar 23, 2016 2:41 am

I am a beginner to VBA programming need help to resolve the problem
ActiveSheet.Paste .. highlighted in yellow

Thank you for help !! :roll: :shock:
Code: Select all

Sub Segar()
'
' Segar Macro
'
' Keyboard Shortcut: Ctrl+Shift+N
'
ActiveCell.Select
    ActiveCell.FormulaR1C1 = "segar"
    ActiveCell.Offset(1, 0).Range("A1").Select
    ActiveCell.FormulaR1C1 = "=NOW()"
    ActiveCell.Offset(-1, 0).Range("A1:A2").Select
    ActiveCell.Activate
    Selection.Copy
    Application.CutCopyMode = False
    ActiveSheet.Paste
    ActiveCell.Offset(2, 0).Range("A1").Select
End Sub
  • 0

segar
Rookie
 
Posts: 2
Joined: Mar 23, 2016
Reputation: 0
Excel Version: 2013

Re: run time error 1004 paste method worksheet class faailed

Postby pecoflyer » Wed Mar 23, 2016 2:52 am

Hi and welcome

Please describe your problem. Thank you
  • 0

A relevant topic title helps get faster and more answers
pecoflyer
Moderator
 
Posts: 1274
Joined: Jan 24, 2012
Location: Belgium
Reputation: 39
Excel Version: 2003/2007/2010

Re: run time error 1004 paste method worksheet class faailed

Postby segar » Wed Mar 23, 2016 4:32 am

HI

Thank you for your prompt help ,
Sorry i am began to learn VBA programming ! :shock: :shock: :roll:

After creating VBA macro
I did ctrl+shift+N to test the macro in same worksheet in another cell
run time error 1004 paste method worksheet class failed = msg appeared.
  • 0

segar
Rookie
 
Posts: 2
Joined: Mar 23, 2016
Reputation: 0
Excel Version: 2013

Re: run time error 1004 paste method worksheet class faailed

Postby NoSparks » Wed Mar 23, 2016 8:43 am

Don't know what you're trying to do nor where you're trying to do it but the reason for paste failing is Application.CutCopyMode=False clears what you just copied to the clipboard before you paste it.... there's nothing to paste.

I'd suggest for testing things not using a keyboard shortcut.
Put the cursor anywhere within the macro and use the F8 key.
This will step through the macro one line at a time and you can go to the sheet, or better yet hit the Window Key and Right Arrow to split your screen, and watch what's actually happening.
  • 0

NoSparks
Excel Hobbyist
 
Posts: 637
Joined: May 28, 2014
Reputation: 103
Excel Version: 2010


Return to Macros and VBA Questions

Who is online

Users browsing this forum: Google [Bot] and 39 guests

cron