Results 1 to 2 of 2

Method 'Range' of Object'_Global' Failed Error

Threaded View

  1. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Method 'Range' of Object'_Global' Failed Error

    First thought is that you spelled something wrong and that either the sheet Problem3 does not exist or the named range PaymentAmount does not exist on the sheet Problem3. Double check for leading and trailing spaces as they matter.

    Edit:
    Here, run this code as a separate subroutine. It should tell you if what I think is correct.

    Sub Test_for_Range()
    Dim SheetName As String, NamedRange As String
    
    ''''''''''''''''''''''''''''''''''''''''''''''''
    '
    '  Enter the sheet name and named range you want
    '  to test for:
    
       SheetName = "Problem3"
       NamedRange = "PaymentAmount"
    
    '
    ''''''''''''''''''''''''''''''''''''''''''''''''
    
    Dim ws As Worksheet:    Set ws = Nothing
    Dim rng As Range:   Set rng = Nothing
    Dim str As String
    
    On Error Resume Next
    Set ws = Sheets(SheetName)
    Set rng = Sheets(SheetName).Range(NamedRange)
    
    If Not ws Is Nothing And Not rng Is Nothing Then
        str = "The worksheet: " & SheetName & " exists." & vbCr _
                & "The named range: " & NamedRange & " exists."
    ElseIf Not ws Is Nothing And rng Is Nothing Then
        str = "The worksheet: " & SheetName & " exists." & vbCr _
                & "The named range: " & NamedRange & " does not exist."
    Else
        str = "The worksheet " & SheetName & " does not exist. Correct it and rerun code to verify the named range."
    End If
    On Error GoTo 0
    
    MsgBox str
    
    End Sub
    Last edited by stnkynts; 10-13-2014 at 07:32 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Getting error Method 'Range' of object '_Global' failed
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-20-2013, 04:35 PM
  2. VBA Method 'Range' of object '_Global' failed error
    By RxMiller in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2011, 11:06 AM
  3. Error: Method 'Range' of object '_Global' failed
    By awan0126 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2011, 07:25 PM
  4. VBA Method 'Range' of object '_Global' failed error
    By JKCincy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-21-2009, 07:46 PM
  5. Method 'Range' of object' _Global failed error
    By randell.graybill in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-12-2009, 01:52 AM

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