Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
目标: 删除每个单词末尾的字母。 我想从“请求的结果”列中获得结果。
问题: 如何使用 VBA 编码来做到这一点? 不要忘记“空白”。
使用 Excel 公式
=MID(A2,1,SEARCH("(",A2,1)-1)
使用 VBA
Sub test() Dim lastRow As Long lastRow = Range("A" & Rows.Count).End(xlUp).Row For i = 2 To lastRow Cells(i, 2) = Mid(Cells(i, 1), 1, InStr(1, Cells(i, 1), "(", vbTextCompare) - 1) Next End Sub