Error On Activesheet.paste
Forums Excel Questions ActiveSheet.Paste error Page 1 of 2 12 Last Jump to page: Results 1 to 10 of 13 ActiveSheet.Paste errorThis is a discussion on ActiveSheet.Paste error within the Excel Questions forums, part of the Question Forums category; Hi there, I have looked at previous posts and found some information about ActiveSheet.Paste errors, which appear to be related ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Apr 27th, 2009,11:43 AM #1 chrislp New Member Join Date Mar 2009 Posts 32 ActiveSheet.Paste error Hi there, I have looked at previous posts and found some information about ActiveSheet.Paste errors, which appear to be related to having activate, select and paste functions in the wrong order. I am still getting an error at the ActiveSheet.Paste point of my code which I cannot seem to overcome, although this same code works on another macro doing exactly the same action... Code: ChDir _ "\\workgroup\Highlight_reporting\Templates" Workbooks.Open Filename:= _ "\\workgroup\Highlight_reporting\Templates\Programme report template.xls" Windows("Milestones_matrix.xls").Activate Application.Run "'Milestones_matrix.xls'!ResetFilters" Range("A11").Select Sheets("All Milestones").Select Selection.AutoFilter Field:=18, Criteria1:="=1", Operator:=xlAnd LR = Cells(65536, 3).End(xlUp).Row If LR > 2 Then Range("B3:M" & LR).SpecialCells(xlCellTypeVisible).Copy Windows("Programme report template.xls").Activate ActiveSheet.Paste Application.CutCopyMode = False End If Range("A49").Select Windows("Milestones_matrix.xls").Activate Application.Run "'Milestones_matrix.xls'!ResetFilters" Selection.AutoFilter Field:=19, Criteria1:="=1", Operator:=xlAnd LR = Cells(65536, 3).End(xlUp).Row If LR > 2 Then Range(
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join http://www.mrexcel.com/forum/excel-questions/386580-activesheet-paste-error.html them; it only takes a minute: Sign up ActiveSheet.paste with offset giving error up vote 0 down vote favorite Hello I am new to VBA and I was designing a program. It simply selects Sheet2 and copies something from cell A1. It then selects Sheet1 and offsets from cell A1 and pastes to the newly selected cell. The code http://stackoverflow.com/questions/32031937/activesheet-paste-with-offset-giving-error is as follows. Sub Test() Worksheets("Sheet2").Activate ActiveSheet.Range("A1").Activate Selection.Copy Worksheets("Sheet1").Activate ActiveSheet.Range("A1").Activate ActiveCell.Offset(1, 1).Activate ActiveSheet.PasteSpecial End Sub The strange thing is that if I change the line .Offset(1, 1) to .Offset(1) the program will work correctly. If I do not I get a Run-time error '1004' Application-defined or object-defined error. I am aware that there are better ways to go about this than using selections and while those are interesting to me I would also like to know the reason for the problem. Thank you for your help. excel vba share|improve this question asked Aug 16 '15 at 4:51 Zasekle 31 add a comment| 3 Answers 3 active oldest votes up vote 0 down vote accepted The reason your code is not working is due to the the overuse of the Range .Activate method. This is different from .Range.Select in that it only makes a different cell in the selection the ActiveCell. If the worksheet's Selection object only encompasses a single cell or a range of cells outside of what you are activating, then yes you wil
at the "Activesheet.paste" line i the following code. I do not understand this because the script worke before and now http://www.pcreview.co.uk/threads/activesheet-paste-not-working.970721/ it fails almost every time. Is there another way t paste?: ============================== Run-time error '1004': Paste method of Worksheet class failed ============================== Code as follows ------------------------------------------------------ Public Sub http://www.excelforum.com/excel-programming-vba-macros/376722-runtime-error-1004-paste-method-of-worksheet-class-failed.html UnprotectSheets(Worksheet As String) Worksheets(Worksheet).Unprotect password:="password" End Sub ------------------------------------------------------ Public Sub ProtectSheets(Worksheet As String) Worksheets(Worksheet).Protect password:="password" End Sub ------------------------------------------------------ Public Sub Move_Approved() Dim R As Long Dim LastRow As Long error on Dim PasteRow As Long Dim Selected As String Application.EnableEvents = False 'On Error GoTo Exit_Move_Approved Sheets("Request Purchase").Select LastRow = ActiveSheet.Cells(Rows.Count, "J").End(xlUp).Row If LastRow > 4 Then For R = 5 To LastRow If Cells(R, "J").Value <> "" Then Selected = Selected & R & ":" & R & "," End If Next R Selected = Left(Selected, Len(Selected) - error on activesheet.paste 1) Range(Selected).Select Selection.Copy Sheets("Approved Purchase").Select PasteRow = ActiveSheet.Cells(Rows.Count, "J").End(xlUp).Row 1 UnprotectSheets ("Approved Purchase") Rows(PasteRow & ":" & PasteRow).Select ActiveSheet.Paste '****FAILS HERE***** ProtectSheets ("Approved Purchase") Sheets("Request Purchase").Select UnprotectSheets ("Request Purchase") Selection.Delete ProtectSheets ("Request Purchase") End If Exit_Move_Approved: ProtectSheets ("Request Purchase") ProtectSheets ("Approved Purchase") Application.EnableEvents = True End Su -- Message posted from http://www.ExcelForum.com DTM, Mar 11, 2004 #1 Advertisements Michael J. Malinsky Guest Try ActiveSheet.PasteSpecial. If you look in the Excel VBA help, you will see no Paste method. HTH -- Michael J. Malinsky Pittsburgh, PA "I was gratified to be able to answer promptly, and I did. I said I didn't know." -- Mark Twain "DTM >" <<> wrote in message news... > I am receiving the following error at the "Activesheet.paste" line in > the following code. I do not understand this because the script worked > before and now it fails almost every time. Is there another way to > paste?: > > ============================== > Run-time error '1004': > > Paste method of Worksheet class failed > ==========
Forum Microsoft Office Application Help - Excel Help forum Excel Programming / VBA / Macros runtime error 1004 paste method of worksheet class failed To get replies by our experts at nominal charges, follow this link to buy points and post your thread in our Commercial Services forum! Here is the FAQ for this forum. Closed Thread Results 1 to 15 of 15 runtime error 1004 paste method of worksheet class failed Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 06-06-2005,06:52 AM #1 wilsoj View Profile View Forum Posts Registered User Join Date 06-06-2005 Posts 4 runtime error 1004 paste method of worksheet class failed Hi, Very new to VBA and having trouble with a simple macro running in 2003 that copies and pasts to another worksheet. Code as follows: Private Sub CopyResults_Click() 'Select the filtered data and copy it Range("A23").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Range("F19").Select ' Open the template and copy in the data Workbooks.Open Filename:="C:\Athens Verification Data\Templates\Verification Template.xls" Workbooks("Verification Template.xls").Activate ActiveSheet.Range("A1").Select ActiveSheet.Paste ActiveSheet.Range("A1").Select Application.CutCopyMode = False End Sub When I run CopyResults, the sheet is opened and the data copied correctly, but I get a runtime error 1004 past method of worksheet class failed, with the line 'ActiveSheet.Paste' highlighted. Don't get this when I run the same macro in 2000. Have looked for a solution online but no joy. Be grateful for any advice! Many thanks, Jane Register To Reply 06-06-2005,06:54 AM #2 mangesh_yadav View Profile View Forum Posts Forum Contributor Join Date 06-10-2004 Location India Posts 1,066