Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ra ra is offline
external usenet poster
 
Posts: 27
Default Compare formula/ xlInconsistentFormula

Hi All, I want to look accross a row of formulas and highlight cell
where the formula has changed or is hardcoded.

I have been trying to use xlInconsistentFormula but not having much
luck.. any help or suggestions welcomed.

thanks
Ra

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Compare formula/ xlInconsistentFormula

You could try something like this:

Sub Inconsistent()
Dim myRange As Range, r As Range
Dim StrFormula As String


Set myRange = Range("B8:I8")
StrFormula = Cells(myRange.Row, myRange.Column).FormulaR1C1
For Each r In myRange
If r.FormulaR1C1 < StrFormula Then
r.Interior.ColorIndex = 6
Debug.Print r.FormulaR1C1
End If
Next r

End Sub

HTH,
Barb Reinhardt

"ra" wrote:

Hi All, I want to look accross a row of formulas and highlight cell
where the formula has changed or is hardcoded.

I have been trying to use xlInconsistentFormula but not having much
luck.. any help or suggestions welcomed.

thanks
Ra


  #3   Report Post  
Posted to microsoft.public.excel.programming
ra ra is offline
external usenet poster
 
Posts: 27
Default Compare formula/ xlInconsistentFormula

Thanks, the below code works. -One improvement I need to work on
is to treat each row individually within selection, so it highlights
unique formulas per row rather than per sheet...

Sub Audit_Tool_1()


'Highlights Unique formula's within total selection
Dim rngCell As range, rng As range
Dim strTest As String
Set rng = Application.InputBox(prompt:="Select Range to be
evaluated",
Type:=8)


For Each rngCell In rng
If InStr(1, strTest, rngCell.FormulaR1C1, vbBinaryCompare) = 0
And
_
Len(rngCell.Text) 0 Then
strTest = strTest & "|" & rngCell.FormulaR1C1
rngCell.Interior.ColorIndex = 27
Else
rngCell.Interior.ColorIndex = xlNone
End If
Next
'Highlight Constants (hardcoded) Cells *Note: does not include
constants that contain = (equals)
' E.g. will pick up entry of "30,000" but not "=30,000"
On Error GoTo NotFound
rng.SpecialCells(xlCellTypeConstants, 21).Select
Selection.Interior.ColorIndex = 40
Selection.Font.ColorIndex = 0


' Exit Sub
NotFound:
MsgBox "Finished"


End Sub


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
Compare formula Saintsman Excel Discussion (Misc queries) 2 October 10th 08 09:06 AM
Formula to compare 2 cells lvn-xl New Users to Excel 4 February 15th 08 11:30 AM
Help with Compare Date Formula Dax Arroway Excel Worksheet Functions 3 December 11th 07 02:25 AM
compare formula rbmcclen Excel Discussion (Misc queries) 1 August 11th 06 06:56 PM
compare the value cell then use one formula if <= or another BThrasher Excel Discussion (Misc queries) 1 May 16th 06 03:10 PM


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