我有一个宏来查找公式,并在找到公式后将值粘贴到其中
例如,它找到vlookup,然后更改单元格中的值以粘贴特殊
现在唯一的问题是我无法计算Vlookup出现的次数。目前,我将计数器设置为300,但请让我知道是否可以计算公式。我尝试使用countif,但它查看的值不在公式中
Sub Test_M()
' Find a particular text or Formula and replace it with values
Dim sht As Worksheet
Dim fnd As Variant
Dim rplc As Variant
Dim Ra As Range
Dim counter As Integer
fnd = "=VLOOKUP("
rplc = "Test"
Sheets(1).activate
' Goes to first sheet otherwise it was not replacing the values
For Each sht In activeWorkbook.Worksheets
For counter = 1 To 300
' I want counter to be dynamic based on the numbers of Vlookup formulas
Set Ra = sht.Cells.Find(What:=fnd,LookIn:=xlFormulas,LookAt:=xlPart,SearchOrder:=xlByRows,SearchDirection:=xlNext,MatchCase:= _
False,SearchFormat:=False)
If Ra Is Nothing Then
MsgBox ("Not found Moving to next sheet")
On Error GoTo QUITIT
'For the Last sheet when there is no sheets left
Worksheets(activeSheet.Index + 1).Select
counter = 300
Else
Range(Ra.Address).Value = Range(Ra.Address)
' Changes Formula to Values
End If
Next
Next sht
QUITIT:
MsgBox "Completed"
End Sub
如果有人可以帮助我找到验证码,我将不胜感激
谢谢