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