0
我使用此代碼將名稱轉換爲正確大小寫,例外「von」,「af」,「de」。但它不起作用,因爲這些名字通常是「馮·埃裏克」或「弗蘭克」而不僅僅是「馮」或「af」。我怎樣才能讓excel得到這個?Excel VBA適當,但有例外
Sub ProperCase()
Dim rng As Range
'Use special cells so as not to overwrite formula.
For Each rng In Selection.SpecialCells(xlCellTypeConstants, xlTextValues).Cells
Select Case rng.Value
Case "von", "af", "de"
rng.Value = StrConv(rng.Value, vbLowerCase)
Case Else
'StrConv is the VBA version of Proper.
rng.Value = WorksheetFunction.Proper(rng.Value)
End Select
Next rng
End Sub