LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Object range failed

Ok, the first line of set rung = Range works, but the second time it bombs, why?
This has been working for several years. The first pass, it checks the constants for a protected status, the check is for formulas. If I comment out the bottom half, the thing isn't working now anyway. I can't imagine what is different than in the past.

All this does is put a 0 value in unprotected cells in a range.


Sub Zeros_for_New_Input()
Dim rng As Range, cell As Range
On Error Resume Next
Set rng = Range("Input_area").SpecialCells(xlConstants, xlNumbers)
On Error GoTo 0
If Not rng Is Nothing Then
For Each cell In rng
If cell.Locked = False Then
cell.Value = 0
End If
Next
End If
Set rng = Nothing
Set rng = Range("Input_area").SpecialCells(xlFormulas)

On Error GoTo 0
If Not rng Is Nothing Then
For Each cell In rng
If cell.Locked = False Then
cell.Value = 0
End If
Next
End If

End Sub

 
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
Range of Object Worksheet failed Karen53 Excel Programming 2 March 17th 08 10:45 PM
Range of Object Global failed JasonSelf[_23_] Excel Programming 3 November 3rd 05 08:26 PM
method 'range' of object '_global' failed Schades Excel Programming 2 October 27th 05 01:37 AM
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM


All times are GMT +1. The time now is 06:26 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"