1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| Sub test_xlValues_xlFormulas()
Rows(1).Clear
Cells(1, 2).NumberFormat = "m/d/yyyy"
Cells(1, 2) = Date
Debug.Print
lookin = "xlFormulas"
Cells(1, 2).NumberFormat = "m/d/yyyy"
NumberFormat = Cells(1, 2).NumberFormat
Call testFind(Date, lookin, NumberFormat)
Cells(1, 2).NumberFormat = "dd\/mm\/yyyy"
NumberFormat = Cells(1, 2).NumberFormat
Call testFind(Date, lookin, NumberFormat)
lookin = " xlValues"
Cells(1, 2).NumberFormat = "m/d/yyyy"
NumberFormat = Cells(1, 2).NumberFormat
Call testFind(Date, lookin, NumberFormat)
Cells(1, 2).NumberFormat = "dd\/mm\/yyyy"
NumberFormat = Cells(1, 2).NumberFormat
Call testFind(Date, lookin, NumberFormat)
End Sub
Function testFind(d, lookin, NumberFormat)
If lookin = "xlFormulas" Then
Set Recherche = Rows(1).Find(Date, lookin:=xlFormulas, LookAt:=xlWhole)
Else
Set Recherche = Rows(1).Find(Date, lookin:=xlValues, LookAt:=xlWhole)
End If
If Recherche Is Nothing Then
Debug.Print d & " non trouve avec " & lookin & " si Numberformat = " & NumberFormat
Else
Debug.Print d & " trouve avec " & lookin & " si Numberformat = " & NumberFormat
End If
End Function |
Partager