码迷,mamicode.com
首页 > 其他好文 > 详细

Excel单元格中提取中文

时间:2015-03-10 01:41:54      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:excel vba

打开Excel,按下Alt+F11
插入 -- 模块 -- 粘贴以下公式

Function getcn(mystr As Range)
‘提取中文以及全角字符
Dim temp As String
getcn = ""
For i = 1 To Len(mystr)
    temp = Mid(mystr, i, 1)
    If Evaluate("LenB(""" & temp & """)") = 2 Then
        getcn = getcn & temp
    End If
Next
End Function


然后在Excel中通过公式 =getcn(A1) 引用和计算

本文出自 “foolishfish” 博客,请务必保留此出处http://foolishfish.blog.51cto.com/3822001/1618783

Excel单元格中提取中文

标签:excel vba

原文地址:http://foolishfish.blog.51cto.com/3822001/1618783

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!