+ Reply to Thread
Results 1 to 13 of 13

Runtime error 1004 Method 'Range' of object_ Global Failed

  1. #1
    Forum Contributor
    Join Date
    04-11-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    110

    Runtime error 1004 Method 'Range' of object_ Global Failed

    Can someone please tell me why this code is failing?

    Please Login or Register  to view this content.
    *edit* I = 1 to .rows.count and not 8
    Last edited by stevoDE; 06-29-2017 at 11:48 AM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

    Please ignore this reply.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

    You can't resize <1 and you can't offset -2 from the second column; is what immediately "pops out"
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

    Darn, I wish I'd kept my reply now

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

    Hi,

    You need Cells, not Range if you want to pass a row and column argument like that, and the size and offset are wrong.

    Did you mean to start your loop from B15?
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

    @ Special-K You can reinstate your reply - we won't care and we'd like to see it

  7. #7
    Forum Contributor
    Join Date
    04-11-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    110

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

    Quote Originally Posted by xladept View Post
    You can't resize <1 and you can't offset -2 from the second column; is what immediately "pops out"
    I'm offsetting -2 rows from the last used row starting from the bottom, not from the second column. I'm not sure what you mean about resize <1.

    I have edited my code as 'i' should have been 1. I'm basically trying to check if the value in column H is blank. If it is not, I want to copy that row from column B to H i.e. H resized by -7 columns.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

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


    I was wrong about the column offset as it's, obviously, a row offset.

    Offset and resize do not work the same way, Resize(0,-7) is

    defining a zero rows and negative 7 columns - it can never was:|
    Last edited by xladept; 06-29-2017 at 12:03 PM.

  9. #9
    Forum Contributor
    Join Date
    04-11-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    110

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

    Quote Originally Posted by xladept View Post
    Please Login or Register  to view this content.
    ????


    I was wrong about the column offset as it's, obviously, a row offset.

    Offset and resize do not work the same way, Resize(0,-7) is

    defining a zero rows and negative 7 columns - it can never was:|
    With you now, I wasn't aware you couldn't resize to the left.

    The above doesn't seem to do what I'm after and that's probably because I didn't mention that I want to copy all rows (equivalent of holding down the CTRL key and copying). The above code only copies the last row where the value in column H is not blank.

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

    Try this:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    04-11-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    110

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

    Please ignore.
    Last edited by stevoDE; 06-30-2017 at 06:20 AM.

  12. #12
    Forum Contributor
    Join Date
    04-11-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2010
    Posts
    110

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

    Quote Originally Posted by xladept View Post
    Try this:

    Please Login or Register  to view this content.
    This works. I was looking to only copy the columns (i.e. B:H) within my specified range as opposed to the entire row but I managed to fix that myself.

    Thanks!

  13. #13
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Runtime error 1004 Method 'Range' of object_ Global Failed

    Try:


    Please Login or Register  to view this content.

+ 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. runtime error 1004 range of object global failed excel 2010
    By kwesmc1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2014, 05:22 PM
  2. [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
  3. [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
  4. Method 'Range' of object_ 'Global' Failed
    By naveenmarapaka in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-12-2012, 10:35 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. 1004:runtime error method 'range' of object'_Global failed
    By trksbc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-21-2009, 03:25 AM
  8. 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