Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Method 'Range' of object '_Global' failed

Hi All,

I have the following code in my Excel Macro.
While running this macro I am getting the following error
"Method 'Range' of object '_Global' failed"
What is wrong with this code

Dim i As Long
Dim s As String
i = 1

While (1)
s = "G" + CStr(i)
If Range(s).Value = "Completed" Then
Range(s).EntireRow.Hidden = True
End If

i = i + 1
Wend

Regards,
Moahn.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Method 'Range' of object '_Global' failed

Mohanasundaram,

No termination possible with "While (1)"

try -

Dim i As Long
Dim s As String
i = 1

While (i <= Cells.Rows.Count)
s = "G" + CStr(i)
If Range(s).Value = "Completed" Then
Range(s).EntireRow.Hidden = True
End If

i = i + 1
Wend

regards,

John

"Mohanasundaram" wrote in message
om...
Hi All,

I have the following code in my Excel Macro.
While running this macro I am getting the following error
"Method 'Range' of object '_Global' failed"
What is wrong with this code

Dim i As Long
Dim s As String
i = 1

While (1)
s = "G" + CStr(i)
If Range(s).Value = "Completed" Then
Range(s).EntireRow.Hidden = True
End If

i = i + 1
Wend

Regards,
Moahn.



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
Range of Object _Global Failed Jeffrey Marks Charts and Charting in Excel 0 July 13th 11 07:33 PM
Method 'Range' of object '_global' failed higherlimits Excel Discussion (Misc queries) 3 June 23rd 06 06:16 PM
runtime error 1004 method range of object '_global failed valdesd Excel Discussion (Misc queries) 2 October 6th 05 07:26 PM
Method 'Run' of object '_Global' failed when changing OS and Office versions Ronj Excel Programming 2 August 17th 03 06:12 PM


All times are GMT +1. The time now is 04:29 PM.

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

About Us

"It's about Microsoft Excel"