+ Reply to Thread
Results 1 to 14 of 14

Method 'Range' of object '_Global' Failed

  1. #1
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Method 'Range' of object '_Global' Failed

    Hello everyone,

    New to VBA and I'm in need of some assistance. I'm attempting to insert a formula into a dynamic range of cells, but when I run the code I receive the "Method 'Range' of object '_Global' Failed" error message. Here is my code:

    Please Login or Register  to view this content.
    I can't seem to figure out what I'm doing wrong. Any Ideas?

  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: Method 'Range' of object '_Global' Failed

    What are the values of LC and LA when you get the error?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Method 'Range' of object '_Global' Failed

    LC - 577
    LA - 1048577

    This code seems to work if I have data in more than the first row populated in column C, but as this is the start of the spreadsheet so there is no data other than the column header at this point.

  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: Method 'Range' of object '_Global' Failed

    When you use xlDown on a sheet with no data then you'll end up at the very last row on the sheet which is row 10458576.

    With LA being 1048577 you are going beyond the bottom row of the sheet.

    Where are you trying to put the formula?

  5. #5
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Method 'Range' of object '_Global' Failed

    The data in column B exceeds the data in column C. I would like the formulas to be pasted in column C up to the point where the data in column B stops.

    Hope that makes sense.

  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: Method 'Range' of object '_Global' Failed

    So you want to find the first empty row in column C and copy the formula down until the last populated row in column B?
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Method 'Range' of object '_Global' Failed

    That's exactly right, and it worked like a charm when I ran the code by itself. However, when I run it with the rest of my code I get an 'Application defined or object defined error'.

  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: Method 'Range' of object '_Global' Failed

    What other code?

  9. #9
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Method 'Range' of object '_Global' Failed

    Don't laugh, I'm sure this is horrible inefficient, but I'm a noob.

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Method 'Range' of object '_Global' Failed

    FC_Macro_Sample.xlsm

    This is a sample of what I'm trying to do. The data exists in Sheet1. I'm trying to write a macro get it in the format in sheet3.

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

    Re: Method 'Range' of object '_Global' Failed

    Actually a mistake by me, missed a couple of important dots.
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Method 'Range' of object '_Global' Failed

    It works! But, due to my other code, Excel nearly craps out on me in the process.

    Thank you for the fix.

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

    Re: Method 'Range' of object '_Global' Failed

    I'm pretty sure the rest of the code can be tidied up and that would hopefully speed things up a bit.

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  14. #14
    Registered User
    Join Date
    02-10-2014
    Location
    Somewhere
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Method 'Range' of object '_Global' Failed

    I've actually created another thread for what you discribed:

    http://www.excelforum.com/excel-prog...aste-loop.html

+ 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] Method 'range' of object'_global' failed
    By mdovey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2013, 02:57 PM
  2. Method 'Range' of object'_Global' failed
    By arbulgazar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2013, 06:52 PM
  3. Method 'Range' of object'_Global' failed
    By arbulgazar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-06-2013, 09:17 AM
  4. method 'range' of object'_global' failed
    By cedtech23 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-30-2012, 07:31 PM
  5. Method ‘Range’ of object ‘_Global’ failed
    By The_Vulcan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2007, 05:29 AM

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