View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
GregR GregR is offline
external usenet poster
 
Posts: 246
Default Convert IF formulas to their values

Norman, just one question, what is the 23 in the celltypeformulas and
are there other numbers that have a meaning. TIA

Greg
Norman Jones wrote:
Hii Greg,

Please delete:

.Select


This line was only included for testing purposes!

However, try the following version which is more robust and which caters for
multiple forms of IF formula:

'=============
Public Sub Tester2()
Dim Sh As Worksheet
Dim rng As Range
Dim rCell As Range

Set Sh = ActiveSheet
On Error Resume Next
Set rng = Sh.Cells.SpecialCells(xlCellTypeFormulas, 23)
On Error GoTo 0

If Not rng Is Nothing Then
For Each rCell In rng.Cells
With rCell
If .Formula Like "*IF*" Then
.Value = .Value
End If
End With
Next rCell
End If
End Sub
'<<=============


---
Regards,
Norman