Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

runtime error 1004 method range of object global failed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dreamz - 26 Jan 2006 15:13 GMT
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.

Signature

dreamz

Jim Rech - 26 Jan 2006 16:46 GMT
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

Signature

Jim

|
| what's wrong with this code? "list" is a named range.
[quoted text clipped - 12 lines]
|
| thanks.
Jim Thomlinson - 26 Jan 2006 16:50 GMT
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

Signature

HTH...

Jim Thomlinson

> what's wrong with this code? "list" is a named range.
>
[quoted text clipped - 11 lines]
>
> thanks.
Kris - 26 Jan 2006 19:22 GMT
> what's wrong with this code? "list" is a named range.
>
[quoted text clipped - 9 lines]
>  
> --------------------

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 :)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.