Public Function TypeCell(MyCell As Range) As String
If IsEmpty(MyCell) Then
TypeCell = "Vide"
ElseIf Application.IsText(MyCell) Then
TypeCell = "Texte"
ElseIf Application.IsLogical(MyCell) Then
TypeCell = "Logique"
ElseIf Application.IsErr(MyCell) Then
TypeCell = "Erreur"
ElseIf IsDate(MyCell) Then
TypeCell = "Date"
ElseIf IsNumeric(MyCell) Then
TypeCell = "Nombre"
End If
End Function
Private Sub EXEMPLE()
MsgBox TypeCell(Range("A4"))
MsgBox TypeCell(Sheets(2).Range("A4"))
End Sub