1 2 3 4 5 6 7 8 9 10 11
| Sub test()
Debug.Print MyType(ActiveCell), MyType(ActiveCell, True)
End Sub
Function MyType(Cellule As Range, Optional txt As Boolean)
Dim Tp: Tp = Array(" Non initialisé", "Null", "Integer", "Long", "Single", "Double", "Currency", "Date", "String", "Object", "Erreur Excel", "Boolean ", "Variant ", "DataObject", "Decimal (dans Variant) ", "Byte", "LongLong (VBA 64 bits) ")
Select Case VarType(Cellule.Value)
Case 5: MyType = IIf(Int(Cellule) = Cellule, 2, 5)
Case Else: MyType = VarType(Cellule.Value)
End Select
If txt Then MyType = Tp(MyType)
End Function |
Partager