+ Reply to Thread
Results 1 to 3 of 3

Method 'Range' of object '_Global' failed. error in excel-vba

  1. #1
    Registered User
    Join Date
    05-15-2013
    Location
    Hyderabad
    MS-Off Ver
    Excel 2003
    Posts
    39

    Method 'Range' of object '_Global' failed. error in excel-vba

    Hi All,
    First of all thanks in advance for your time to read and reply for this.

    I am tring to open a file thru vba macro where as path and the file name are refered from 2 different cells
    For Example
    Cell A2 is with Whole file Path and B Column is with multiple FIle names where as I i tried the below code and it bring "Method 'Range' of object '_Global' failed. error in excel-vba" Error Code
    Please help

    x = Range("b" & i).Value
    ChDir Range("A2")
    Workbooks.Open Filename:=Range(x) ----> Hear I get the error code However X is reading the respective file name and so does the chdir range (A2")

    Any help is much appreciated.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Method 'Range' of object '_Global' failed. error in excel-vba

    Hi, naresh73,

    if you assigned the value of a cell to a variable you should not use the command Range for that variable again (that would mean searching for a Named Range of that name in the workbook). Try
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    05-15-2013
    Location
    Hyderabad
    MS-Off Ver
    Excel 2003
    Posts
    39

    Re: Method 'Range' of object '_Global' failed. error in excel-vba

    Hey Holger,

    Thanks a lot mate...It worked for me and thanks once again for the extra one...!!


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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