如何检查单元格值中的第一个字符 [英] How to check first character in a cell value
本文介绍了如何检查单元格值中的第一个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有一种方法可以检查单元格值中的第一个字符.
I was wondering if there is a way to check the first character in a cell value.
例如
01999102477490 ( first char "0" )
11003200602650 (first char "1" )
我要完成的工作是使用IF语句根据"0"和"1"区分单元格值,并将它们分配给不同的列.我可能可以自己声明,我只需要知道如何检查第一个字符"0"和"1"即可.
What I am trying to accomplish is to use an IF statement to distinguish cell values according to "0" and "1" and assign them to different columns. I can probably make the statement on my own, I just need to know how to check the first character for "0" and "1".
我还应该说我要检查整列的值
I should also say that I have whole column of values to check
推荐答案
尝试:
Option Explicit
Sub FirstChar()
Dim xlString As String
Dim xlFirstChar As String
xlString = "01999102477490"
xlFirstChar = Left$(xlString, 1)
MsgBox xlFirstChar
End Sub
这篇关于如何检查单元格值中的第一个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文