我该如何在工作表中替换多个单词?
例如:Da...da,Do...do,Dos,De... de..等。
如何将其应用到名为“Customers3”的电子表格中?
Public Function MyProper(MyString As String, Optional exceptions As Variant)
Dim c As Variant
If IsMissing(exceptions) Then
exceptions = Array("a", "as", "e", "o", "os", "da", "das", "de", "di", "do", "dos", _
"CPF", "RG", "E-Mail")
End If
MyString = Application.Proper(MyString)
For Each c In exceptions
MyString = Replace(" " & MyString & " ", " " & c & " ", " " & LCase(c) & " ", , , vbTextCompare)
Next c
MyProper = MyString
End Sub
=MyProper(A1)
? - VBasic2008