Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-12-2012, 01:44 PM
yonasan yonasan is offline Run time error 1004 Windows 7 64bit Run time error 1004 Office 2010 64bit
Novice
Run time error 1004
 
Join Date: Jun 2012
Posts: 2
yonasan is on a distinguished road
Default Run time error 1004

I have a macro that works fine in excel 2007 but not in excel 2010:
Code:
Sub Synthese2(an1, an2, an5, LMainWB, LNewWB) 


Dim Row, Row1, Row2, n, Col As Integer Dim LNewWB2 As String Call Module1.Copiervalue("Feuil1", "NomSc", "Exec Summary", "NomS") Call Module1.Copiervalue("Feuil1", "_Sc2", "Exec Summary", "Scoller2") Call Module1.Copiervalue("Feuil1", "_Sc3", "Exec Summary", "Scoller3") Call Module1.Copiervalue("Feuil1", "_Sc4", "Exec Summary", "Scoller4") Call Module1.Copiervalue("Feuil1", "_Sc5", "Exec Summary", "Scoller5") Sheets("Exec Summary").Select Application.Goto Reference:="A.Exercice" ActiveCell.FormulaR1C1 = an1 If an5 <> CStr(0) Then n = an1 - an2 - 1 Application.Goto Reference:="_Ref1" Row1 = Application.ActiveCell.Row Range("A" & CStr(Row1 + 1) & ":C" & CStr(Row1 + 3)).Select Selection.Cut Workbooks.Add ActiveSheet.Paste ActiveWindow.Close SaveChanges:=False Range("A" & CStr(Row1 + 1) & ":C" & CStr(Row1 + 3)).Select Selection.Delete Shift:=xlUp Windows(LNewWB).Activate Sheets("Exec Summary").Select Application.Goto Reference:="_Ref2" Rown = Application.ActiveCell.Row Sheets("Exec Summary").Range("A" & CStr(Rown - an5) & ":C" & CStr(Rown - 1)).Select Selection.Copy Windows(LMainWB).Activate Sheets("Exec Summary").Select Application.Goto Reference:="Ref" Row = Application.ActiveCell.Row Selection.Insert Shift:=xlDown \\ The macro crashes here Windows(LNewWB).Activate Sheets("Exec Summary").Select Sheets("Exec Summary").Range("A" & CStr(Rown - an5) & ":A" & CStr(Rown - 1)).Select Selection.Copy Windows(LMainWB).Activate Sheets("Exec Summary").Select Sheets("Exec Summary").Range("A" & CStr(Row)).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False For i = 0 To an5 Sheets("Exec Summary").Rows(CStr(Row1 + 1 + i) & ":" & CStr(Row1 + 1 + i)).RowHeight = 350 Next i Application.Goto Reference:="_Ref2" Selection.Rows.AutoFit If n > 0 Then For i = 1 To n Call Synthese.Cut Next i End If End If End Sub
For some reason I cannot insert what is copied in the bold line. After running the macro, i cannot even insert a row myself without the error "cannot shift object off sheet"

Thanks

Last edited by macropod; 06-12-2012 at 06:35 PM. Reason: Added code tags & structure
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Run time error 1004 runtime error 1004 gbaker Excel Programming 11 06-06-2012 05:23 AM
Word Visual Basic error - run time error 504 crazymorton Word 11 01-13-2012 04:32 AM
Run time error 1004 Error:Power point can't readthe outline from time-world.ppt.No text converter is inst aligahk06 PowerPoint 1 10-21-2011 03:48 AM
Run time error 1004 Run-time error 438 cksm4 Word 2 01-12-2011 03:41 PM
Word: The document 'Filename' caused a serious error the last time ... martincruise Word 0 02-25-2010 01:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft