










Sub RemoveTextBetweenSlashes() Dim rng As Range Dim cell As Range '这里假设要处理的是当前活动工作表中已使用的单元格区域,你可以修改为特定的单元格范围 Set rng = ActiveSheet.UsedRange For Each cell In rng Dim text As String text = cell.Value Dim startSlash As Long, endSlash As Long startSlash = InStr(text, "/") Do While startSlash > 0 endSlash = InStr(startSlash + 1, text, "/") If endSlash > 0 Then text = Left(text, startSlash - 1) &"|"& Mid(text, endSlash + 1) startSlash = InStr(text, "/") Else startSlash = 0 End If Loop cell.Value = text Next cell End Sub
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。