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: 9
Default How to zero out cells with formulas in them but no precedents?

I have the below code I am using to try to zero out constant numbers in
models. The section I have 'ed out seems to work fine. The second section I
am trying to use to find cells which have formulas in them but no predents
and zero those.
Thanks for the help.

Sub Zeroing()


Dim rng As Range

' Set rng = ActiveSheet.UsedRange.SpecialCells(xlCellTypeConst ants,
xlNumbers)
' For Each cell In rng
' If Not IsDate(cell.Value) Then
' cell.Value = 0
' cell.Font.ColorIndex = 5
' End If
' Next cell
Set rng = ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormu las,
xlNumbers)
For Each cell In rng
If Not shprec(ActiveCell) Then
cell.Value = 0
cell.Font.ColorIndex = 5
End If
Next cell

'
End Sub

Function shprec(cell As Range)

On Error GoTo noprec
cell.Precedents.Show
shprec = True
Exit Function

noprec:
shprec = False

End Function

 
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
Precedents Abdul Shakeel Excel Discussion (Misc queries) 3 July 25th 08 08:08 PM
Exact Precedents Abdul Shakeel Excel Worksheet Functions 8 July 23rd 08 04:55 AM
Excel XP: Showing Trace Precedents Arrows for Multiple Cells... Birmangirl Excel Discussion (Misc queries) 3 September 27th 05 02:12 PM
Precedents Property Derek[_6_] Excel Programming 1 November 8th 03 12:51 PM
Trace Precedents Hawk Excel Programming 2 November 8th 03 01:55 AM


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