Results 1 to 13 of 13

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

Threaded View

  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;

    Public Sub keep_osItems()
    'Copies o/s items to month 0.
        Dim diff As Long, i As Long, n As Long
        clear_dataEnquiry
        vFilter searchColumn:=7, viewRange:=Range("allTxns"), anyValue:=True
        Range("dataEnquiry").Sort Range("enquiryStart").Offset(0, 10)
        diff = (Range("enquiryEnd").row - Range("enquiryStart").row) - (Range("obEnd").row - Range("obStart").row) + 2
        If diff > 0 Then
            n = Range("obEnd").row - 1
            For i = 1 To diff
                Rows(n).EntireRow.Insert
                Range("M" & n).Formula = "=M" & ActiveCell.row - 1
            Next
            monthsDown Range("obStart").row + 1
        End If
        Range("B" & Range("enquiryStart").row, "I" & Range("enquiryEnd").row).Copy destination:=Range("obStart").Offset(2)
    End Sub
    The problematic piece of code highlighted by Visual Basic in debug mode is;

    diff = (Range("enquiryEnd").row - Range("enquiryStart").row) - (Range("obEnd").row - Range("obStart").row) + 2
    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.

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