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
|
Sub Test()
Dim Plage As Range
Dim Cel As Range
Dim LaDate As Date
Set Plage = Range("B3:C3")
LaDate = Date
Application.FindFormat.Clear
Application.FindFormat.NumberFormat = "m/d/yyyy"
Set Cel = Plage.Find(Format(LaDate, "m/d/yyyy"), , xlValues, xlWhole, , , , , True)
If Not Cel Is Nothing Then MsgBox "Test 1 : " & Cel.Address(0, 0)
Set Cel = Plage.Find(Format(LaDate, "m/d/yyyy"), , xlValues, xlWhole, , , , , False)
If Not Cel Is Nothing Then MsgBox "Test 2 : " & Cel.Address(0, 0)
Set Cel = Plage.Find(LaDate, , xlValues, xlWhole, , , , , True)
If Not Cel Is Nothing Then MsgBox "Test 3 : " & Cel.Address(0, 0)
Set Cel = Plage.Find(LaDate, , xlValues, xlWhole, , , , , False)
If Not Cel Is Nothing Then MsgBox "Test 4 : " & Cel.Address(0, 0)
Application.FindFormat.Clear
Application.FindFormat.NumberFormatLocal = "jj/mm/aaaa"
Set Cel = Plage.Find(Format(LaDate, "m/d/yyyy"), , xlValues, xlWhole, , , , , True) 'pas trouvée !
If Not Cel Is Nothing Then MsgBox "Test 5 : " & Cel.Address(0, 0)
Set Cel = Plage.Find(Format(LaDate, "m/d/yyyy"), , xlValues, xlWhole, , , , , False)
If Not Cel Is Nothing Then MsgBox "Test 6 : " & Cel.Address(0, 0)
Set Cel = Plage.Find(LaDate, , xlValues, xlWhole, , , , , True) 'par trouvée !
If Not Cel Is Nothing Then MsgBox "Test 7 : " & Cel.Address(0, 0)
Set Cel = Plage.Find(LaDate, , xlValues, xlWhole, , , , , False)
If Not Cel Is Nothing Then MsgBox "Test 8 : " & Cel.Address(0, 0)
End Sub |
Partager