+ Reply to Thread
Results 1 to 6 of 6

Active sheet.paste error - macro

  1. #1
    Registered User
    Join Date
    03-28-2008
    Posts
    73

    Active sheet.paste error - macro

    Hello,
    Seeking some help please. Novice at recording macro. I have pasted some data into worksheet one click on match destination formatting, and then started the macro recording. I then select all in the top left corner, copy and paste the same into worksheet two.
    I then work through formulas and conditional formatting one worksheet one and then slightly different on worksheet two. It all seems to work when I record it.
    However when I try to run it it gives me this message:
    Run time error 1004
    Paste method of worksheet class failed
    When I have a look Activesheet paste is highlighted in yellow.

    Selection.Insert Shift:=xlToRight
    Range("C10").Select
    ActiveCell.FormulaR1C1 = "RULEONE"
    Range("C11").Select
    ActiveSheet.Paste
    With Selection.Font
    .Name = "Arial"
    .Size = 12
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ColorIndex = xlAutomatic
    End With .


    I haven’t pasted the full code as there is a lot of rows where I scroll which takes up lots of space.
    Gil

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Active sheet.paste error - macro

    hello,

    Please use code tags around your code.
    The code you have posted also has a lot of things going on that are not nessary. If you could post a workbook i could go over it or post the complete code.

    cheers


  3. #3
    Registered User
    Join Date
    03-28-2008
    Posts
    73

    Re: Active sheet.paste error - macro

    Hello, Thank you.This is my first attempt at recording a macro in which I went through everything that I required.I have not developed any code,it was all done through the recording of a macro.I have enclosed the workbook.
    Thank you for your assisitance.
    Gil
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Active sheet.paste error - macro

    hello again.

    Ive scrached the surface of the code there. When using the macro recoreder it recordes everythink and most of the stuff it records isnt nessary. selecting cells before making changes to the isnot nessary.
    ive ran out of time for now though this runs fine. you will have to cheek the output though.
    Please Login or Register  to view this content.
    cheers
    Last edited by D_Rennie; 02-04-2010 at 11:21 PM.

  5. #5
    Registered User
    Join Date
    03-28-2008
    Posts
    73

    Re: Active sheet.paste error - macro

    Hello, Thankyou for your attempts to help.I tried the code however the result was as attached.There was hardly any detail shown?
    Gil
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Active sheet.paste error - macro

    ok Its obvious somethink has gone wrong.
    i see that for for reason when ii posted
    Please Login or Register  to view this content.
    its somehow been with
    Please Login or Register  to view this content.
    im not sure if anyone else has experienced this type of thing on the forum as its im sure the code tags has morphed other parts aswell kust not sure what yet.

    /
    /
    anyhow to answer the 1st qwestion you had with the activesheet.paste maby when you where recording the macro you have gone outside of excel and copied somethink and then brought it back. as there is no other logical reason it should be in the code.
    so try removing it and see if it runs.
    '

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1