+ Reply to Thread
Results 1 to 4 of 4

Error Method Range of Object - Global Failed

  1. #1
    Registered User
    Join Date
    12-28-2014
    Location
    Birmingham, England
    MS-Off Ver
    2010
    Posts
    54

    Error Method Range of Object - Global Failed

    Hi

    I have created a directory to refer to various files and initialised variables accordingly. I recently added 2 more files to the directory but when I run the macro it gives me an error when it reaches the "Jo File". Not sure why the code is not able to assign the variable JoFile to Price Desk Quotesheet Jo.xlsx

    I am only getting this error for the files recently added - Jo and TAW - hope someone can explain where I've gone wrong....

    File attached with screen shots of code and directory

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,466

    Re: Error Method Range of Object - Global Failed

    Have you created the Named Range "JoFile"?
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    12-28-2014
    Location
    Birmingham, England
    MS-Off Ver
    2010
    Posts
    54

    Re: Error Method Range of Object - Global Failed

    Hi

    Im not sure I understand what you mean....sorry I am quite new to vba programming....

    The project involves combining data from the files listed in the directory - For eg. Price Desk Quotesheet Jo, Price Desk Quotesheet Mia etc. into a master file. I earlier did the project with the files Mia,Bill,Jonas, Lars and Mario and it initialized the variables fine. But then I added in two more files - Jo and TAW and for some reason, the code is giving me an error when assigning Price Desk Quotesheet Jo to JoFile.

    Any ideas why?

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Error Method Range of Object - Global Failed

    JoFile =Range("JoFile")

    You can refer to a range in a number of ways. You can use a range string address, like Range("A1:K10")

    JoFile =Range("A1:K10")

    OR use a "Named Range". You probably know how to create a named range in excel. So, instead of refering to Range("A1:K10"), you can name the range as "Jofile".
    It is most likely that the person who created the original sheet has already defined the named range. If the error is due to named range missing, you can easily check if the named range has been created for the 2 new additions.
    Go to: Formula-click Name manager, then you should see all valid range names. If you can see all the other names (Mia,Bill,Jonas, Lars and Mario), but not the one you added, you need to add them.
    Last edited by AB33; 11-18-2016 at 06:46 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Error - Method 'range of object' - Global failed
    By highlystrung in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2015, 06:18 AM
  2. method union of object global failed error
    By evanzo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-29-2013, 11:07 PM
  3. Method 'Cells of Object' Global failed error
    By TimmerSuds in forum Excel General
    Replies: 2
    Last Post: 05-20-2012, 09:29 AM
  4. Method Range of object global failed
    By paddingtonstation in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-08-2012, 07:33 AM
  5. 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
  6. 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
  7. 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