View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
James Butler James Butler is offline
external usenet poster
 
Posts: 5
Default Find Hard Coded Cells

Hi, I am not sure I completely understand your question, do you want
to delete the edits or amend them or ...

a couple of ideas, one is once you have got all of the hardcoded
numbers turned blue you could write some code to ignore those and only
look at the ones that are left. ie:

Range("A1").Select
Do Until ActiveCell.Formula = ""

If ActiveCell.Font.ColorIndex < 5 Then
ActiveCell.ClearContents
End If

ActiveCell.Offset(1, 0).Select

Loop

This would then scroll down column a and delete any thing that wasn't
blue.

The other option is that you could use:

Sub ColorCellsOnce()
On Error Resume Next
Cells.SpecialCells(xlCellTypeConstants, 1).Font.ColorIndex = 5

Cells.SpecialCells(xlCellTypeFormulas, 1).Font.ColorIndex = 3
On Error GoTo 0
End Sub


Which would then turn any formulas red, I have probable misunderstood
your question but hope my ideas help.

James


"Steph" wrote in message ...
Hi everyone. I have a small piece of code that finds cells that have
hardcoded numbers in them and colors the cell blue. Unfortunately, it only
finds "true hardcoded" cells, for example, the number 23456. What it does
not find is =A1+23456. I have a huge file that my boss has sporadically
edited cells with numbers to make a certain value. I need to find those
"edits" and remove them. Any ideas on how to modify the below code to finds
the numbers within a formula like =A1+23456? Thank you!


Sub ColorCellsOnce()
On Error Resume Next
Cells.SpecialCells(xlCellTypeConstants, 1).Font.ColorIndex = 5
On Error GoTo 0
End Sub