Results 1 to 3 of 3

runtime error 1004 range of object global failed excel 2010

Threaded View

  1. #1
    Registered User
    Join Date
    01-12-2014
    Location
    Plano, Tx
    MS-Off Ver
    365
    Posts
    57

    runtime error 1004 range of object global failed excel 2010

    I got this error on Excel 2010, however the code below works perfectly fine on 2007. I changed all the settings on 2010 on Trust Center, but still no go. I am getting the error on the code below (Range("Week" & WeekNo).Copy. Can someone please tell me why this code works in 2007 but does not in 2010? Thanks.

    Sub Macro2()
    
     ' Keyboard Shortcut: Ctrl+z
     '
    
    
    
    
    
     Dim wbkOtherWorkbook As Workbook
     ' Set wbkOtherWorkbook = Workbooks("District Foodcost.xls") 'Assuming this workbook is already open
    
    
     Dim wbMyBook As Workbook
     Set wbMyBook = ActiveWorkbook
     Set objOutlook = GetObject(, "Outlook.Application")
    
     Dim MySelection As Range
     Set MySelection = Application.InputBox(prompt:="Select a Cell ie... G3", Type:=8)
     MySelection.Select
     ' ActiveWorkbook.Sheets("Weekly Food Cost").Activate
    
     Workbooks(1).Activate
    
     Dim WeekNo As Variant
    
     Do
     WeekNo = Application.InputBox _
     ("Enter week number", , , , , , , 1)
     If WeekNo = "False" Then
     Exit Do
     End If
     Loop Until WeekNo >= 1 And WeekNo <= 4
    
     Workbooks(2).Activate
     If WeekNo <> "False" Then 
    Range("Week" & WeekNo).Copy
     Workbooks(1).Activate
     ' Windows("District Foodcost.XLS").Activate
    
     Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
     :=False, Transpose:=False
     End If
     Dim Wb As Workbook
     For Each Wb In Workbooks
     If Wb.Name <> ThisWorkbook.Name Then
     Wb.Close savechanges:=False
     End If
     Next Wb
     Range("E3").Select
     ' objOutlook.Application.Quit
    
     End Sub
    Last edited by alansidman; 02-05-2014 at 05:17 PM. Reason: code tags added

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Runtime Error '1004' Method 'Range' of object '_Worksheet' failed
    By ovalstar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2013, 02:15 PM
  2. [SOLVED] Runtime error 1004: Method 'Range' of object '_Worksheet' failed
    By Phil Payne in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2013, 01:30 AM
  3. Run-time error '1004': Method 'Range' of object 'Global' failed
    By djwestholm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2012, 04:52 PM
  4. Run-time error '1004': Method 'Range' of object '_ Global' failed
    By mdvc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-20-2011, 11:48 AM
  5. runtime error 1004 method range of object global failed
    By dreamz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-26-2006, 03:25 PM

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