+ Reply to Thread
Results 1 to 4 of 4

runtime error 1004 method range of object global failed

  1. #1
    Registered User
    Join Date
    08-19-2005
    Posts
    58

    runtime error 1004 method range of object global failed

    what's wrong with this code? "list" is a named range.

    Please Login or Register  to view this content.
    thanks.

    edit: it turns out the named range definition got screwed up somehow.
    Last edited by dreamz; 01-26-2006 at 11:44 AM.

  2. #2
    Jim Rech
    Guest

    Re: runtime error 1004 method range of object global failed

    The error message suggests that there is no range named 'list' in the active
    workbook.

    Your code snippet was not complete. If this doesn't run I think it's pretty
    conclusive that 'list' is not a named range.

    Sub Test()
    Dim CurCell As Range
    For Each CurCell In Range("List").Cells
    Debug.Print CurCell.Address
    Next
    End Sub


    --
    Jim
    "dreamz" <[email protected]> wrote in
    message news:[email protected]...
    |
    | what's wrong with this code? "list" is a named range.
    |
    |
    | Code:
    | --------------------
    |
    | Private Sub Test()
    | Dim CurCell As Object
    |
    | Application.ScreenUpdating = False
    |
    | For Each CurCell In Range("List")
    |
    | --------------------
    |
    |
    | thanks.
    |
    |
    | --
    | dreamz
    | ------------------------------------------------------------------------
    | dreamz's Profile:
    http://www.excelforum.com/member.php...o&userid=26462
    | View this thread: http://www.excelforum.com/showthread...hreadid=505327
    |



  3. #3
    Jim Thomlinson
    Guest

    RE: runtime error 1004 method range of object global failed

    CurCel should be declared as type Range not Object. Otherwise there is
    nothing wrong (So long as List is a valid named range). I might do something
    more like

    Private Sub Test()
    Dim CurCell As Range
    dim rngList as range

    Application.ScreenUpdating = False
    on error resume next
    set rngList = Range("List")
    on error goto 0

    if rnglist is nothing then
    msgbox "Range List does not exist"
    else
    For Each CurCell In rngList

    --
    HTH...

    Jim Thomlinson


    "dreamz" wrote:

    >
    > what's wrong with this code? "list" is a named range.
    >
    >
    > Code:
    > --------------------
    >
    > Private Sub Test()
    > Dim CurCell As Object
    >
    > Application.ScreenUpdating = False
    >
    > For Each CurCell In Range("List")
    >
    > --------------------
    >
    >
    > thanks.
    >
    >
    > --
    > dreamz
    > ------------------------------------------------------------------------
    > dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
    > View this thread: http://www.excelforum.com/showthread...hreadid=505327
    >
    >


  4. #4
    Kris
    Guest

    Re: runtime error 1004 method range of object global failed

    dreamz wrote:
    > what's wrong with this code? "list" is a named range.
    >
    >
    > Code:
    > --------------------
    >
    > Private Sub Test()
    > Dim CurCell As Object
    >
    > Application.ScreenUpdating = False
    >
    > For Each CurCell In Range("List")
    >
    > --------------------
    >
    >


    Go to Insert/Name/Define , find "list" on a list and check if you see
    name of worksheet in that line.
    If yes, it means that "list" is defined on specific sheet only, and
    doesn't not exist when other sheet is active.
    If you don't see a name of worksheet -> I don't know why it doesn't work

+ 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