+ Reply to Thread
Results 1 to 13 of 13

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

  1. #1
    Registered User
    Join Date
    03-24-2010
    Location
    Omagh
    MS-Off Ver
    Excel 2003
    Posts
    6

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

    Hey,

    I work for an accountancy firm which uses a bookkeeping package incorporated into Microsoft Excel via Visual Basic. We have been having a problem when we attempt to balance forward to the next accounting year. It is at this stage that we receive the Run-time error message 1004. It relates to the following piece of code;

    Please Login or Register  to view this content.
    The problematic piece of code highlighted by Visual Basic in debug mode is;

    Please Login or Register  to view this content.
    My knowledge of Visual Basic is school level standard and was wondering if anyone would know what the problem is.

    Thanks in advance.
    Last edited by claremount; 03-24-2010 at 12:27 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

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

    Welcome to the forum.

    Please take a few minutes to read the forum rules, and then edit your post to add code tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    03-23-2010
    Location
    England
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    27

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

    When code breaks have you tried querying each value of this line in the immediate pane?
    ?Range("enquiryEnd").row
    etc
    It may be that one of your range names is incorrect, but doing this should help to narrow the problem down.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

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

    dv8, please take a few minutes to read the forum rules about posting in threads with pending moderation.

  5. #5
    Registered User
    Join Date
    03-24-2010
    Location
    Omagh
    MS-Off Ver
    Excel 2003
    Posts
    6

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

    Thanks for the welcome.

    Sorry for not originally adding the coding tags.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,062

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

    I suspect the ranges are not on the active sheet so you should qualify them with the sheet to which they belong:
    Please Login or Register  to view this content.
    If they are all on the same sheet, you can neaten that with a With...End With construction.
    Everyone who confuses correlation and causation ends up dead.

  7. #7
    Registered User
    Join Date
    03-24-2010
    Location
    Omagh
    MS-Off Ver
    Excel 2003
    Posts
    6

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

    The ranges are all on the active sheet. I included the With .. End With construction just in case. Same Run Time Error 1004 being produced.
    Last edited by shg; 03-25-2010 at 04:54 PM. Reason: deleted spurious quote

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,062

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

    Then I would suspect that your code is not in a normal module, but in a worksheet module?
    If you post a sample workbook, we could stop guessing...

  9. #9
    Registered User
    Join Date
    03-24-2010
    Location
    Omagh
    MS-Off Ver
    Excel 2003
    Posts
    6

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

    Sorry Romper I was not involved in the design of the code and my knowledge of VB is limited at best. How would I know if the code was in a worksheet module as opposed to a normal module?

    Further, how would I post a sample worksheet. I do apologize for my lack of technological know how in this area. As I said I was not involved in the design of the programme and I have just been asked to sort it!!

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,062

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

    If you click the Go Advanced button below the message box when posting, there is a Manage Attachments button that will allow you to upload a workbook. (Delete any confidential data first!)

  11. #11
    Registered User
    Join Date
    03-24-2010
    Location
    Omagh
    MS-Off Ver
    Excel 2003
    Posts
    6

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

    Thanks. Will upload shortly once all confidential data has been removed.

    It appears as if the problem lies with Range("obEnd").row part of the code.

  12. #12
    Registered User
    Join Date
    03-24-2010
    Location
    Omagh
    MS-Off Ver
    Excel 2003
    Posts
    6

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

    Heres a blank version of the worksheet.

    I had to zip the file as it would not seem to upload otherwise.

    Thanks in advance.
    Last edited by claremount; 03-29-2010 at 04:02 AM.

  13. #13
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,062

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

    Your obEnd range seems to have a #REF! error in it.

+ 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