Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Function 查找关键字、替换和循环_Function_Loops_Find_Keyword - Fatal编程技术网

Function 查找关键字、替换和循环

Function 查找关键字、替换和循环,function,loops,find,keyword,Function,Loops,Find,Keyword,我写这个脚本是为了找到一个关键字“S”,然后在三列中执行一个公式。到目前为止,它只找到了“S”的第一个实例。我希望它继续搜索并为存在“S”的每一行执行公式。有人能帮我循环下面的代码吗?非常感谢 Worksheets("Sheet2").Activate Dim c As Range Set c = Range("B:B").Find _ (what:="S", LookIn:=xlFormulas, _ lookat:=xlWhole, SearchOrder:=xlByRows, Search

我写这个脚本是为了找到一个关键字“S”,然后在三列中执行一个公式。到目前为止,它只找到了“S”的第一个实例。我希望它继续搜索并为存在“S”的每一行执行公式。有人能帮我循环下面的代码吗?非常感谢

Worksheets("Sheet2").Activate
Dim c As Range
Set c = Range("B:B").Find _
(what:="S", LookIn:=xlFormulas, _
lookat:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not c Is Nothing Then c.Offset(0, 3) = c.Offset(0, 1) * c.Offset(0, 2) * 0.05

看起来像VB。是VBA吗?是的,这是excel中的VBA。