+ Reply to Thread
Results 1 to 11 of 11

run-time error '1004' method 'range' of object '_global' failed

  1. #1
    Forum Contributor
    Join Date
    02-23-2015
    Location
    united kingdom
    MS-Off Ver
    14.0.7143.5000 (32-bit)
    Posts
    124

    run-time error '1004' method 'range' of object '_global' failed

    I have a code that generates the part called "Machined" from already existing parts in the list called "As wound".

    This macro inserts number of rows specified by the user in the input box and fills in appropriate cells.

    Code does work perfectly fine if the sample selected is at the first position of the table (Row 9) , but anything that is below this row will prompt with an error:

    "run-time error '1004' method 'range' of object '_global' failed"


    Here is my file

    example.xlsm

    Many thanks

  2. #2
    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

    Which sub should we be looking at?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    02-23-2015
    Location
    united kingdom
    MS-Off Ver
    14.0.7143.5000 (32-bit)
    Posts
    124

    Re: run-time error '1004' method 'range' of object '_global' failed

    Quote Originally Posted by Norie View Post
    Which sub should we be looking at?
    machining_gen

    sorry should have removed the others

  4. #4
    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

    I tried that and couldn't generate an error.

    Is there anything specific I should be doing/entering?

  5. #5
    Forum Contributor
    Join Date
    02-23-2015
    Location
    united kingdom
    MS-Off Ver
    14.0.7143.5000 (32-bit)
    Posts
    124

    Re: run-time error '1004' method 'range' of object '_global' failed

    Quote Originally Posted by Norie View Post
    I tried that and couldn't generate an error.

    Is there anything specific I should be doing/entering?
    make sure you are generating the part that is second on the list in the Mk6e-i2 GR tab
    ,

    in "Machining" tab put 55 in cell J10
    and click generate part

  6. #6
    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

    The reason for the error is that myrange is empty, why it's empty I'm not sure yet but I think it could be because the selected ID isn't being found.

    I found some problems in your code, specifically with one line if statements and Exit For.

    I've, hopefully, fixed some of those problems in the following code.

    Can't guarantee it does what it's supposed to, not too sure what that is - lot of looping going on, but this runs without error.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    02-23-2015
    Location
    united kingdom
    MS-Off Ver
    14.0.7143.5000 (32-bit)
    Posts
    124

    Re: run-time error '1004' method 'range' of object '_global' failed

    Quote Originally Posted by Norie View Post
    The reason for the error is that myrange is empty, why it's empty I'm not sure yet but I think it could be because the selected ID isn't being found.

    I found some problems in your code, specifically with one line if statements and Exit For.

    I've, hopefully, fixed some of those problems in the following code.

    Can't guarantee it does what it's supposed to, not too sure what that is - lot of looping going on, but this runs without error.
    Please Login or Register  to view this content.
    almost well done:P

    IT does run but for some reason it does not put letters to new part starting from an "A" even though it suppose to according to code.

  8. #8
    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

    Does it do anything?

  9. #9
    Forum Contributor
    Join Date
    02-23-2015
    Location
    united kingdom
    MS-Off Ver
    14.0.7143.5000 (32-bit)
    Posts
    124

    Re: run-time error '1004' method 'range' of object '_global' failed

    Quote Originally Posted by Norie View Post
    Does it do anything?
    yes it works apart from inserting letter not staring with an "A" as it suppose to according to
    Please Login or Register  to view this content.
    chr(56) is an "A"

  10. #10
    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

    Is it only A that's missing?

  11. #11
    Forum Contributor
    Join Date
    02-23-2015
    Location
    united kingdom
    MS-Off Ver
    14.0.7143.5000 (32-bit)
    Posts
    124

    Re: run-time error '1004' method 'range' of object '_global' failed

    Quote Originally Posted by Norie View Post
    Is it only A that's missing?
    "A" is not missing if I start from first row in a table
    but if I do generate part thas is lower down on the list it starts from letter corresponding to offset from 1st row.
    Looking at the code it should do "A" regardless of position
    Last edited by nosense; 09-22-2015 at 03:16 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. Run-time error '1004' Method 'Range' of object'_Global' failed
    By mbie451 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-11-2014, 01:40 PM
  2. [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
  3. [SOLVED] Run-time error ‘1004’: Method ‘Range’ of ‘object’_Global’ failed.
    By dhiresh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-08-2013, 12:04 PM
  4. Run-time-error 1004 -- Method 'Range' of object '_Global' failed
    By tilleyd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-04-2012, 10:55 PM
  5. Run-Time Error 1004 Method Range of object _Global Failed?
    By MadDino in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-11-2011, 05:13 AM
  6. 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
  7. [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