|
Sub SearchFormula()
Dim mySearch(), sh As Worksheet
Dim i As Integer
Dim c As Range
mySearch = Array("SUMIFS", "INDEX")
For i = 0 To UBound(mySearch)
For Each sh In Worksheets
With ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormulas)
Set c = .Find(mySearch(i), LookIn:=xlFormulas)
Do
c.Value = c.Value
Set c = .FindNext(c)
Loop Until c Is Nothing
End With,next
Next i
End Sub
包含SUMIFS,INDEX函数的单元格转化成值了。 - Sub SearchFormula()
- Dim mySearch(), sh As Worksheet
- Dim i As Integer
- Dim c As Range
- Dim rg As Range
- On Error Resume Next
- mySearch = Array("SUMIFS", "INDEX")
- For i = 0 To UBound(mySearch)
- For Each sh In Worksheets
- Set rg = sh.UsedRange.SpecialCells(xlCellTypeFormulas)
- If Not rg Is Nothing Then
- With rg
- Set c = .Find(mySearch(i), LookIn:=xlFormulas, lookat:=xlPart)
- Do While Not c Is Nothing
- c.Value = c.Value
- Set c = .FindNext(c)
- Loop
- End With
- End If
- Set rg = Nothing
- 'Set c = Nothing
- Next
- Next i
- End Sub
复制代码
|
|