|
用asc来判断,假设是判断a1单元格:
s = cells(1, 1) '读取a1
s1 = ""
for i = 1 to len(s)
s3 = mid(s, 1, 1) '截取第一位字符
s2 = asc(s3) 'asc码
If (s2 >= 65 and s2 <= 90) Or (s2 >= 48 and s2 <= 57) Or (s2 = 32) Or (s2 = 95) then
s1 = s1 & s3 '有一种更简单的判断方法,我不用记不住,asc判断也不难
end If
s = mid(s, 2, 254)
next i
cells(1, 2) = s1 '把转换后的结果写入b2 |
|