+ Reply to Thread
Results 1 to 16 of 16

Run-time error '1004: Method 'range' of object'_Global' failed

  1. #1
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Run-time error '1004: Method 'range' of object'_Global' failed

    Hi,

    I am getting this "Run-time error '1004: Method 'range' of object'_Global' failed" for the below code.Please advise.
    Please Login or Register  to view this content.
    Thanks in advance!

  2. #2
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    you've set your variable as a 'variant' data type, try range instead.

  3. #3
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    I have changed to Range but still getting same error.
    Getting this error mainly this type of file "Microsoft Office Excel 97-2003 Worksheet"

    Thanks!

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

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    You can not set to non VBA object.
    I think LastCol is a long variable, not an object, so remove set

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    If I remove set and put the above code,getting same error for this line:
    Please Login or Register  to view this content.
    Thanks!

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

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    What are you trying to do?
    I do not like go to and will avoid using it if I can.

  7. #7
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    If I remove go to what I have to use instead?

    Thanks!

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

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    Only if I knew what are you trying to do.

  9. #9
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    I am trying to select active cell to last used cell in a row.

    Thank!

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

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    I do not think you can use an active cell as cells address.

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    Make clear what you want the result to be.....

    This one selects the active cell until the last cell in that row
    Please Login or Register  to view this content.

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

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    This one works too, but avoid active cell again.

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    This code is working only for first row.
    If I want to select any other rows it is not working.

    Thanks!

  14. #14
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    Thanks for now let you know if I have any problem.

  15. #15
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    For selection of selected cell (on any row) to last cell used in the row:
    Please Login or Register  to view this content.

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '1004: Method 'range' of object'_Global' failed

    In the version of Excel you mention the columns only go up to IV.
    Please Login or Register  to view this content.
    Last edited by Norie; 02-01-2014 at 06:03 AM.
    If posting code please use code tags, see here.

+ 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] Run-time error 1004 - Method 'Range' of object'_Global' failed
    By onmyway in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-24-2013, 03:33 PM
  2. Run-time error '1004'. Method 'Range' of object '_Global' failed
    By mjj347 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-24-2012, 11:09 AM
  3. Run-time error '1004': Method 'Range' of object '_Global' failed
    By claremount in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-26-2010, 08:01 AM
  4. Run time error 1004 - Method 'Range' of 'Object'_Global' failed
    By excelaspire0219 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-10-2009, 01:18 PM
  5. [SOLVED] Run-time error '1004': Method 'Range' of object '_Global' failed
    By Neild in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-12-2006, 07:50 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