Sub RemoveBrackets() Dim ws As Worksheet Dim rng As RangeDim cell As Range Dim cellValue As String Dim i As Integer ' 指定工作表 Set ws = ThisWorkbook.Sheets("Sheet1") ' 修改 "Sheet1" 为你工作表的名字 ' 指定范围 (C 列) Set rng = ws.Range("C1:C" & ws.Cells(ws.Rows.Count, "C").End(xlUp).Row) ' 遍历范围内的每个单元格 For Each cell In rng cellValue = cell.Value ' 删除中英文括号及其内容 Do While InStr(cellValue, "(") > 0 Or InStr(cellValue, "(") > 0 i = InStr(cellValue, "(") If i > 0 Then cellValue = Left(cellValue, i - 1) & Mid(cellValue, InStr(i, cellValue, ")") + 1) End If i = InStr(cellValue, "(") If i > 0 Then cellValue = Left(cellValue, i - 1) & Mid(cellValue, InStr(i, cellValue, ")") + 1) End If Loop cell.Value = cellValue Next cell
End Sub
Alt+F11 插入新模块,保存以上代码后退出。Alt+F8 选中模块执行
......查看全文