Excel 2016 VBA 提取单元格的中文字符
启用开发工具

方式一:【右键Sheet1 】->【查看代码】
方式二:【开发者工具】->【Visual Basic】




Function chinese(rng As String)
Dim regx As Object
Dim strs, str, i
Set regx = CreateObject("vbscript.regexp")
With regx
.Global = True
.Pattern = "[\u4e00-\u9fa5]"
Set strs = .Execute(rng)
For Each i In strs
str = str & i
Next
If Len(str) > 0 Then
chinese = str
Else
chinese = ""
End If
End With
End Function

本文来自博客园,作者:VipSoft 转载请注明原文链接:https://www.cnblogs.com/vipsoft/p/16941993.html
浙公网安备 33010602011771号