View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_1218_] Simon Lloyd[_1218_] is offline
external usenet poster
 
Posts: 1
Default Formulas containing hard coded values


I'm not sure what you are trying to achieve, anyway, try this, don't
forget to change the range.
Code:
--------------------
Sub formulae()
Dim MyCell As Range
Dim C As String, D As String
For Each MyCell In Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
If IsNumeric(MyCell) Then
C = C & vbLf & MyCell.Address
ElseIf MyCell.HasFormula And MyCell.Text < vbNullString Then
D = D & vbLf & MyCell.Address
End If
Next
MsgBox "Cells with Numeric values:" & vbLf & C & vbLf & vbLf _
& "Cells with Text values:" & vbLf & D
C = ""
D = ""
End Sub
--------------------


Bony Pony;440595 Wrote:
Hi all,
I am in receipt of a workbook in which someone has "amended" random
formulas
with harcoded additions - eg
=a1*b1*1.7
or
=if(a1=0,"None,"OK")

Does anyone have a vba approach to identify a cell that contains
hardcoded
numbers or text?

Thanks in advance!
Bony



--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=122224