Activesheet.pastespecial Error 1004
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings vba error 1004 pastespecial method of range class failed and policies of this site About Us Learn more about Stack
Vba Runtime Error 1004 Pastespecial Method Of Range Class Failed
Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs vba paste error 1004 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 them;
Vba Pastespecial
it only takes a minute: Sign up VBA Error 1004: PasteSpecial method of range class failed up vote 0 down vote favorite I'm having a bit of trouble with any kind of paste method I use at the moment. Data from one sheet must be cut and pasted to another, but I'm not sure what I'm missing. The error occurs clear clipboard vba here, shortly after the commented "HERE" : Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False Full code can be found below, thanks for any replies. Option Explicit Public Sub Workbook_Open() Application.ScreenUpdating = False Application.DisplayAlerts = False Dim wb As Variant Dim wsName As Variant Dim blastrow As Variant Dim flastrow As Variant Dim lastrow As Variant ActiveWorkbook.Sheets("combined").Select Range("A1:U9999").ClearContents Dim MyObj As Object, MySource As Object, file As Variant file = Dir("G:\BS\Josh Whitfield\Credit_Chasing\NEW PROCESS\") 'file level loop While (file <> "") If InStr(file, ".xlsx") > 0 Then Workbooks.Open "G:\BS\Josh Whitfield\Credit_Chasing\NEW PROCESS\" & file wb = ActiveWorkbook.Name 'ws = ActiveSheet.Name Dim ws As Worksheet 'worksheet/tab level loop For Each ws In ActiveWorkbook.Worksheets ws.Activate wsName = ws.Name 'andrew code (09/12/2015) blastrow = Workbooks("Copy of merge.xlsb").Worksheets("Combined").Range("A" & Rows.Count).End(xlUp).Row + 1 If blastrow = 2 Then blastrow = 1 Workbooks("Copy of merge.xlsb").Worksheets("Combined").Range("A" & blastrow & ":XFD" & blastrow).Value = _ Workbooks(wb).Worksheets(wsName).Range("A1:XFD1").Value lastrow = Range("A" & Rows.Count).End(xlUp).Row 'finding status column Range("M1").Select Do Until ActiveCell.Value = "Status" Or ActiveCell.Column > 100 If Range("A2") = "" Then GoTo there End If ActiveCell.Offset(0, 1).Select Loop 'looping through Do U
be down. Please try the request again. Your cache administrator is webmaster. Generated Fri, 30 Sep 2016 02:10:43 GMT by s_hv902 (squid/3.5.20)
Way | Trading Add-ins For Excel | Convert Excel Into Calculating Web Pages Excel Web Pages | Produce Clean Efficient VBA Code Every Time | Build Automated Trading Models In Excel | Excel Web Pages | http://www.ozgrid.com/forum/showthread.php?t=166433 Excel Video Training Forum New Posts FAQ Calendar Forum Actions Mark Forums Read Quick Links http://www.pcreview.co.uk/threads/runtime-error-1004-pastespecial-method-of-range-class-failed.2372860/ Today's Posts What's New? Advanced Search Forum HELP FORUMS Excel General Runtim error 1004 when trying to pastespecial in VBA Excel Training / Excel Dashboards Reports If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. error 1004 To start viewing messages, select the forum that you want to visit from the selection below. If you don't like Google AdSense in the posts, register or log in above. Click here to view the relaunched Ozgrid newsletter. Page 1 of 2 1 2 Last Jump to page: Results 1 to 10 of 13 Thread: Runtim error 1004 when trying to pastespecial in VBA Thread Tools Show Printable Version Search Thread Advanced Search error 1004 pastespecial June 13th, 2012 #1 espens View Profile View Forum Posts Member Join Date 10th June 2012 Posts 32 Runtim error 1004 when trying to pastespecial in VBA Hello Suddenly I get an runtime error when the macro is trying to copy and pastespecial. It worked fine yesterday, but now it errors. Why?? VB: wb1.Activate ws1.Range("AA23:AA29").Copy ws2.Activate ws2.Range("S" & g).PasteSpecial _ Paste:=xlValues, Transpose:=True Regards Espen Excel Video Tutorials / Excel Dashboards Reports Reply With Quote June 13th, 2012 #2 jindon View Profile View Forum Posts Excel Samurai Join Date 19th July 2004 Location Tokyo, Japan Posts 9,423 Re: Runtim error 1004 when trying to pastespecial in VBA 1) What value does variable "g" hold? 2) Is ws2 set properly to the sheet object and visible? Excel Video Tutorials / Excel Dashboards Reports Reply With Quote June 13th, 2012 #3 espens View Profile View Forum Posts Member Join Date 10th June 2012 Posts 32 Re: Runtim error 1004 when trying to pastespecial in VBA Hello g has a value from 2 to lastrow, usually 3 or 4, but in this case it errors on the first occurance, g = 2 ws2 should be correct, see my code below. Kind regards Espen VB: Sub Open60only() ''' Finner skrivebordet til den respektive datamaskinen Desktop = CreateObject("WScript.Shell"). _ SpecialFolders("Desktop") & Application.PathSeparator Dim which_folder As String, which_file As
Guest a vba-excel-based application i created for a client has been suffering from a bug, the runtime 1004 error. i can't figure out what the problem is, as i've tried it on two different computers and i can't reproduce it on either of them. Code: -------------------- shOppFit.Range(Range("Y4:Z4"), Range("Y4:Z4").End(xlDown)).Copy With shTemp .Activate .Range("Q1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats End With -------------------- it fails during the pastespecial method. thanks. -- dreamz ------------------------------------------------------------------------ dreamz's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=26462 View this thread: http://www.excelforum.com/showthread.php?threadid=507929 dreamz, Feb 2, 2006 #1 Advertisements Dave Peterson Guest Is it this line shOppFit.Range(Range("Y4:Z4"), Range("Y4:Z4").End(xlDown)).Copy if Yes, try fully qualifying those ranges: with shOppFit .Range(.Range("Y4:Z4"), .Range("Y4:Z4").End(xlDown)).Copy end with The dots in front of the .ranges mean that that thing belongs to the object in the previous with statement. Without fully qualifying those ranges, those ranges will refer to the activesheet (or the worksheet that holds the code--if you're in a worksheet module). dreamz wrote: > > a vba-excel-based application i created for a client has been suffering > from a bug, the runtime 1004 error. > > i can't figure out what the problem is, as i've tried it on two > different computers and i can't reproduce it on either of them. > > Code: > -------------------- > > shOppFit.Range(Range("Y4:Z4"), Range("Y4:Z4").End(xlDown)).Copy > With shTemp > .Activate > .Range("Q1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats > End With > > -------------------- > > it fails during the pastespecial method. > > thanks. > > -- > dreamz > ------------------------------------------------------------------------ > dreamz's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=26462 > View this thread: http://www.excelforum.com/showthread.php?threadid=507929 -- Dave Peterson Dave Peterson, Feb 3, 2006 #2 Advertisements Dave Peterson Guest Oops on the .pastespecial line.... Are you using the same version of excel? xlpastevaluesandnumberformats was added in a newer version. Your client may