vba 判断类型
原始数据
ID num REMARK CHECK
mary 100 Chinese
john 1001 2020/1/1
eric 999 666
hello 1
- 判断是否为日期 Isdate
- 是否为数字Isnumeric
Sub shishi()
Dim i As Integer
For i = 2 To Cells(65536, 1).End(xlUp).Row
If IsNumeric(Cells(i, 3)) Then
Cells(i, 4) = "is num"
ElseIf IsDate(Cells(i, 3)) Then
Cells(i, 4) = "is date"
End If
Next
End Sub
ID num REMARK CHECK
mary 100 Chinese
john 1001 2020/1/1 is date
eric 999 666 is num