还有1种是用Excel的函数:
判断 A1单元格
T= Application.WorksheetFunction.IsNumber(Range("a1"))
如果 T 返回True 则为数字,否则不是
也可以用返回值类型来判断是不是数字
示例:
Dim ws As Worksheet
Set ws = ActiveWorkbook.ActiveSheet
Dim value As Variant
value = ws.Cells(16, 1)
dim typevalue as variant
typevalue=typename(value)
typevalue的值会返回"String","Double"
"Double"就是数字了
if left(cells(i,1).value,5)="2011_" then
或者
if cells(i,1).value like "2011_" & "*" then
isnumeric(cells(i,j))