其他分享
首页 > 其他分享> > Excel 怎么用VBA代码快速查找替换指定字符

Excel 怎么用VBA代码快速查找替换指定字符

作者:互联网

strSearch 是被查找的内容
strReplace 是替换的内容

Sub FindAndReplace(ByVal strSearch As String, ByVal strReplace As String)

    Cells.Replace What:=strSearch, Replacement:=strReplace, LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
        
End Sub

Sub main()
     Call FindAndReplace("abcd", "ww")
End Sub

  

标签:VBA,False,Sub,strReplace,Excel,查找,ByVal,End,strSearch
来源: https://www.cnblogs.com/wzihan/p/14887866.html