1
我想要在Excel中删除右侧的文本和连字符。删除第二个连字符后的文本
我列例如:
Fresh Start Recovery, Inc. - Wayne
FSA Property Mgmt - Danny
Georgia Securing Svcs, Inc. - Katrina
Georgia - SFFS - Joe & Roxana
Greenwood - Lonnie
Griffis Recovery, LLC - Tyler (5% WC)
Hi Cap, Inc. - Doug
我需要它看起来像这样:
Fresh Start Recovery, Inc.
FSA Property Mgmt
Georgia Securing Svcs, Inc.
Georgia - SFFS
Greenwood
Griffis Recovery, LLC
Hi Cap, Inc.
我的代码,将删除文本和连字符的权利,但如果我有两个连字符我需要它删除第二个,我的代码删除第一个。
Dim iPos As String
Dim c As Range
For Each c In Range("a1:a" & Range("a" & Rows.Count).End(xlUp).Row)
iPos = InStr(1, c.Value, " - ")
If iPos > 0 Then
c.Value = Left(c.Value, iPos - 1)
End If
Next
End Sub
工作完美!非常感谢,我一直在为此工作好几天。 – user1013478