如果您尝试在宏中执行此操作,那么您也可以尝试 VBA Replace 语句。它比替代功能好得多。
您可以使用以下宏来帮助您的事业:
Sub ChangeTerms()
Dim rows As Integer
Dim cellvalue As String
Dim Newcellvalue As String
rows = ActiveSheet.UsedRange.rows.Count
For i = 1 To rows
cellvalue = ActiveSheet.Cells(i, 1).Value
Newcellvalue = Replace(cellvalue, " Inc.", "")
Newcellvalue = Replace(Newcellvalue, " Inc,", "")
Newcellvalue = Replace(Newcellvalue, " Inc", "")
Newcellvalue = Replace(Newcellvalue, " LLC", "")
ActiveSheet.Cells(i, 1).Value = Newcellvalue
Next i
End Sub
这个宏的核心是替换函数。如果您需要了解有关此功能的更多信息,请查看以下资源:
http://www.exceltrick.com/formulas_macros/vba-replace-function
http://msdn.microsoft.com/en-us/library/bt3szac5(v=vs.80).aspx