llgd.net
当前位置:首页 >> ExCEl vBA 删除特殊字符 >>

ExCEl vBA 删除特殊字符

Sub s() Dim arr, i%, t%, c As Range arr = Array("#", "%", "&", "$", "^") For Each c In [c51:f55] For i = 0 To UBound(arr) t = InStr(c.Text, arr(i)) If t > 0 Then c = Mid(c.Text, t) Exit For End If Next NextEnd Sub

你最好吧特殊字符放在一个字符串里,我可以试试为你写一个 Const sList = "[]{}【】()()", sRange = "B5:P10"Sub Arrange() Dim aRr Dim i As Integer, j As String Dim rT, rC As Range Set rT = Sheets(1).Range(sRange) ReDim aRr(1 To Len...

答: Sub Demo() Dim LR As Long LR = Cells(Cells.Rows.Count, 1).End(xlUp).Row With CreateObject("VBSCRIPT.REGEXP") .Pattern = "\*.+\*" For i = 1 To LR Cells(i, 1) = .Replace(Cells(i, 1), "") Next End WithEnd Sub

sub test()myrow=Range("A65536").End(xlUp).Rowfor i=myrow to 1 step -1 if range("A" & myrow )="X" then Range("A" & i & ":A" & myrow).ClearContents end ifnextend sub

Sub 去除特殊字符() Dim n, txArr, tx_s, tx_Asc, s, c, new_s n = 100 '处理的最大行数,可更改 tx_s = "#,*,%,&" '特殊字符,可增加 txArr = Split(tx_s, ",") tx_Asc = "," For i = 0 To UBound(txArr) tx_Asc = tx_Asc & Asc(txArr(i)) & ",...

Sub aa()For Each c In Selectionc.Value = Left(c.Value, Len(c.Value) - 2)NextEnd Sub 鼠标选中需要修改的数据区域,运行宏aa

这个确实是只删除右侧的两个字符。 我不知道为啥你运行会删了前和后的。。。。 想要删除左侧两个字符,第三行改成 c.Value = Right(c.Value, Len(c.Value) - 2)两边都删就是 c.Value = Mid( c.Value, 2, Len(c.Value) - 4)

Sub 删除字符()arr = [c2:h20]Set regex = CreateObject("VBScript.RegExp")regex.Global = Trueregex.Pattern = "[,。@#$%&]+"For i = 1 To UBound(arr) For j = 1 To UBound(arr, 2) arr(i, j) = regex.Replace(arr(i, j), "/") NextNext[c2:...

这种生僻字的区位码估计会靠后,你把所有要删除的发上来看看,或者上个图片,取汉字的区位码,然后判断就简单一点 传个照片或者文档,我查一下区位码有没有规律

假设数据在A列 在B1输入公式 =REPLACE(A1,1,1,) 回车确定,鼠标对准单元格右下角,当出现一个黑色小十字时,同时按住鼠标左键往下拖动填充 用替换(Ctrl+H),查找字为固定字符,替换为不输入任何值,点击全部替换。 示例,把下表中的百度批量删除。

网站首页 | 网站地图
All rights reserved Powered by www.llgd.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com