Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default runtime error 1004 method range of object global failed


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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" wrote in
message ...
|
| 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime error 1004 method range of object '_global failed valdesd Excel Discussion (Misc queries) 2 October 6th 05 07:26 PM
Runtime Error 1004 Select method of Range class Failed IanO Excel Programming 2 June 16th 05 07:40 PM
Runtime Error 1004 - Method Range of '_Global failed' Sworkhard Excel Programming 3 July 9th 04 04:20 AM
Runime Error 1004 Method Range of Object Global Failed Mohan[_5_] Excel Programming 3 May 21st 04 03:35 PM
runtime error '1004' delete Method of Range Class Failed Tom Kennedy Excel Programming 0 April 14th 04 08:08 PM


All times are GMT +1. The time now is 04:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"