Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/23.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
“在Excel中替换VBA”;语句外部类型块“无效”;_Vba_Excel - Fatal编程技术网

“在Excel中替换VBA”;语句外部类型块“无效”;

“在Excel中替换VBA”;语句外部类型块“无效”;,vba,excel,Vba,Excel,出现编译错误,“语句在类型块外部无效” 我试图在C列中搜索字符串“Steel Structural”,如果它存在,则将其替换为“Structural Steel” 我需要这是一个我按下的按钮,这样在单元格格式中就没有循环,否则我只需要使用一个基本的excel函数来反转单词 这是我的密码: Private Sub CommandButton1_Click() Range("C:C").Select If MT = "Steel Structural" Then Replace("Steel Str

出现编译错误,“语句在类型块外部无效”

我试图在C列中搜索字符串“Steel Structural”,如果它存在,则将其替换为“Structural Steel”

我需要这是一个我按下的按钮,这样在单元格格式中就没有循环,否则我只需要使用一个基本的excel函数来反转单词

这是我的密码:

Private Sub CommandButton1_Click()
Range("C:C").Select
If MT = "Steel Structural" Then
Replace("Steel Structural", "Steel Structural", "Structural Steel") As String
End Sub
我做错了什么?

想想:

Sub dural()
   Dim C As Range
   Set C = Range("C:C")

   C.Replace What:="Steel Structural", Replacement:="Structural Steel"
End Sub

作品非常感谢你!