Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 06-12-2012, 01:59 PM
Colin Legg's Avatar
Colin Legg Colin Legg is offline Run time error 1004 Windows 7 32bit Run time error 1004 Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

Hi and welcome to the forum.

There are a number of things which can cause this error. Please can you attach your workbook to the thread?
__________________
Colin

RAD Excel Blog
Reply With Quote
  #3  
Old 06-12-2012, 02:40 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

I would rather not as material contained within is confidential.
As mentioned, the macro is fine in excel 2007. I can tell you that whats being copied are embedded word documents from another file

Thanks
Reply With Quote
  #4  
Old 06-12-2012, 11:08 PM
Colin Legg's Avatar
Colin Legg Colin Legg is offline Run time error 1004 Windows 7 32bit Run time error 1004 Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

Follow the steps here to see if it fixes it.

http://blog.contextures.com/archives...in-excel-2007/


If that fails you can always remove the confidential data and attach the workbook so we can help you.
__________________
Colin

RAD Excel Blog
Reply With Quote
Reply

Thread Tools
Display Modes


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 07:09 AM.


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