如何使用Excel 2013/2016中的用户定义函数或VBA宏从字符串中删除非字母数字字符
时间:2022-05-30 12:14:43
本文将讲述如何在Excel中从给定单元格中的文本字符串中删除所有非字母数字字符。如何使用Excel 2013/2016中的用户定义函数或VBA宏从字符串中删除非字母数字字符。
使用用户定义的函数删除所有非字母数字字符
使用VBA宏删除所有非字母数字字符
使用用户定义的函数删除所有非字母数字字符
假设您有一个包含文本字符串值的范围A1:A3中的数据列表,并且您只想从这些单元格中删除所有非字母数字字符并保留其他字母数字字符。怎么做。您需要记下Excel VBA宏以实现快速删除所有非字母数字字符的结果。只需执行以下步骤:
步骤1:打开您的Excel工作簿,然后单击开发工具选项卡下的“Visual Basic”命令,或者只需按“ALT + F11”快捷方式。
步骤2:然后将出现“Visual Basic编辑器”窗口。
步骤3:单击“插入” – >“模块”以创建新模块。
步骤4:将以下VBA代码粘贴到代码窗口中。然后单击“保存”按钮。
Function RemoveNonAlpha(str As String) As String Dim ch, bytes() As Byte: bytes = str For Each ch In bytes If Chr(ch) Like "[A-Z.a-z 0-9]" Then RemoveNonAlpha = RemoveNonAlpha & Chr(ch) Next chEnd Function
标签:如何,使用,Excel,2013,2016,中的,用户,定义,函数
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Excel和Html怎么互换格式转换?
2023-08-09 14:11:22
![](https://img.aspxhome.com/file/2023/6/36046_0s.jpg)
word文档如何插入对号
2023-07-12 20:19:07
![](https://img.aspxhome.com/file/2023/1/32231_0s.png)
iOS 16 中相册重复项目功能使用方法
2023-06-14 12:13:46
![](https://img.aspxhome.com/file/2023/8/45088_0s.png)
word文档中段落标记或回车标记怎么消除呢?
2023-04-20 06:35:17
![](https://img.aspxhome.com/file/2023/6/23476_0s.png)
Excel怎么快捷输入有固定内容的数据
2022-08-20 05:14:42
![](https://img.aspxhome.com/file/2023/6/37346_0s.jpg)
Excel中双击妙用的小技巧
2022-03-01 19:29:06
pdf转换word的软件如何使用
2022-04-28 15:31:51
在word文档中如何快速制作表格呢?
2022-06-14 15:10:08
![](https://img.aspxhome.com/file/2023/9/25249_0s.jpg)
EXCEL如何取整数
2023-06-06 12:14:46
![](https://img.aspxhome.com/file/2023/7/36407_0s.jpg)
word怎么删除页眉页脚
2022-11-20 14:18:06
![](https://img.aspxhome.com/file/2023/4/33674_0s.jpg)
Win10电脑使用IE11浏览器打开PDF却无法打印怎么办?
2022-09-08 01:20:29
![](https://img.aspxhome.com/file/2023/5/52275_0s.jpg)
Endnote导入到pdf中自动生成的文件?
2023-08-02 17:20:57
![](https://img.aspxhome.com/file/2023/7/15287_0s.jpg)
geomean函数怎么使用?实例详解excel中GEOMEAN函数用法
2022-07-27 16:47:28
![](https://img.aspxhome.com/file/2023/3/40203_0s.png)
Win10你的电脑遇到问题需要重新启动怎么办?
2022-07-27 02:37:19
![](https://img.aspxhome.com/file/2023/0/51920_0s.jpg)
Excel2019怎么筛选并计算数据?Excel2019筛选计算数据教程
2022-09-30 02:10:19
![](https://img.aspxhome.com/file/2023/0/40020_0s.jpg)
ie浏览器edge浏览器两者之间有什么区别?
2023-08-21 02:59:37
![](https://img.aspxhome.com/file/2023/9/47079_0s.jpg)
word怎么调出标尺
2022-02-09 14:00:03
![](https://img.aspxhome.com/file/2023/5/34515_0s.gif)
如何在Word2010中更正拼写时仅根据主词典提供建议
2022-10-29 14:36:59
![](https://img.aspxhome.com/file/2023/1/29921_0s.jpg)
手把手教您如何在word中设置等式序号
2023-04-02 08:55:23
![](https://img.aspxhome.com/file/2023/5/35625_0s.jpg)
Win10怎么切换账户?Win10系统切换账户的方法教程
2022-06-28 00:20:41
![](https://img.aspxhome.com/file/2023/7/52527_0s.png)