你这个问题问的笼统了点.这个要分几种情况
1.是只判断首字符.
2.是判断所有的字符.这种情况又分为必须全部是汉字才认为是汉字,或只要包含汉字就认为该单元格的内容是汉字这2种情况.
给你个简单的只判断首字符的例子你先看看
Function isHZ(SA As Range) As Boolean
aa = Asc(SA.Value)
If aa < 0 Then isHZ = True Else isHZ = False
End Function
Function ddd(str)
Dim i As Integer
For i = 1 To Len(str)
If Asc(Mid(str, i, 1)) >= -20319 And Asc(Mid(str, i, 1)) <= -2050 Then
ddd = "含有汉字"
Exit Function
End If
ddd = "无汉字"
Next
End Function
使用方法:判断A1单元格是否有汉字
=ddd(A1)
自已写一个函数
返回 True--含有汉字
返回 False--不含有汉字
Function HasWideChr(ByVal str As String) As Boolean
Dim ByteGB() As Byte
Dim LenW As Integer
ByteGB = StrConv(str, vbFromUnicode)
LenW = UBound(ByteGB) + 1
HasWideChr = Len(str) <> LenW
End Function
Sub Test()
Dim rng As Range
For Each rng In Range("A1", [A65536].End(3))
If rng Like "*[一-龥]*" Then MsgBox "中文"
Next
End Sub
if left(cells(i,1).value,5)="2011_" then
或者
if cells(i,1).value like "2011_" & "*" then