-
Since "=GXL(" does not exist look for "GXL(".
[VBA]Sub Test_FoundFormulaRanges()
Dim findRange As Range, findString As String, foundRange As Range
Dim r As Range, i As Long, ws As Worksheet
On Error GoTo EndNow:
'http://vbaexpress.com/kb/getarticle.php?kb_id=1035
'SpeedOn
For Each ws In Worksheets
Set findRange = ws.Cells.SpecialCells(xlCellTypeFormulas)
findString = "GXL("
Set foundRange = FoundFormulaRanges(findRange, findString)
If Not foundRange Is Nothing Then
foundRange.Value = foundRange.Value
End If
Next ws
EndNow:
'SpeedOff
End Sub
Function FoundFormulaRanges(fRange As Range, fStr As String) As Range
Dim objFind As Range
Dim rFound As Range, FirstAddress As String
With fRange
Set objFind = .Find(what:=fStr, After:=fRange.Cells(fRange.Rows.Count, fRange.Columns.Count), _
LookIn:=xlFormulas, lookat:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
If Not objFind Is Nothing Then
Set rFound = objFind
FirstAddress = objFind.Address
Do
Set objFind = .FindNext(objFind)
If Not objFind Is Nothing Then Set rFound = Union(objFind, rFound)
Loop While Not objFind Is Nothing And objFind.Address <> FirstAddress
End If
End With
Set FoundFormulaRanges = rFound
End Function
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules